Access VBADiscuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
In Access 2000 does anyone know what "databasetype" I would use in the connection string if I'm trying to connect via Windows NT authentication? "ODBC Database" doesn't seem to work. I keep getting the error message Run-time error '3170' "Could not find installable ISAM".
Below is a Database Connection example that I've used with Access 2000:
Code:
Public Sub CompleteDatabaseExample()
Dim dbMain as New ADODB.Connection ' Declaring the Connection
Dim rsCustomer as New ADODB.Recordset ' Declaring the Recordset
Dim SQL as String ' Declaring a simple variable
dbMain.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ ' Connecting to the Database
"Persist Security Info=False;" & _
"Data Source=C:\WINDOWS\Desktop\training.mdb"
SQL = "SELECT * FROM Customer" ' Setting up our SQL Command statement
rsCustomer.Open SQL, dbMain, adOpenDynamic, adLockOptimistic ' Opening the Recordset (see Recordset Options)
Do While Not rsCustomer.EOF ' Loop until we reach the End-Of-File marker
MsgBox "The Customer's Name is: " & rsCustomer("Name")
MsgBox "The Customer's City is: " & rsCustomer("City")
rsCustomer("Country") = "United States"
rsCustomer("Name") = rsCustomer("Name") & " Jr."
rsCustomer.Update ' Updating the Records (see also Recordset (Working With))
rsCustomer.MoveNext ' Moving to the next record (necessary to reach the EOF)
Loop
rsCustomer.Close ' Closing the recordset
dbMain.Close ' Closing the database connection
End Sub