by Lewis Gardner <lgardner@[EMAIL PROTECTED]
>
Aug 22, 2007 at 12:30 AM
Dave wrote:
> I've been reading some old posts that talk of an inability to connect
> to an Access database with RB. Is that (still) true? If so, that
> would be a show stipper for us.
RB connects to Access via ODBC fairly easily. Here is a simple example
of reading data from a MBD:
Dim db as ODBCDatabase
db=New ODBCDatabase
dim curTotal As Currency
db.DataSource= "Driver={Microsoft Access Driver (*.mdb)}; DBQ=my.mdb "
If db.Connect then
dim rs As RecordSet
rs = db.SQLSelect("SELECT ID, Amount FROM tblPaymentDetail")
while not rs.EOF
curTotal = curTotal + rs.Field("Amount").Value
rs.MoveNext
wend
EditField1.Text = Format(curTotal, ",###.##")
else
MsgBox "The connection failed."
end if