10-15-2004, 11:58 AM
Hi i was jus wondering if someone could perhaps give me the a code so that my VB created form will display daat from an Access database?
My requirement is i will have a drop down list of peoples names and when that name is selected i want the info on that person in the Access data base to be displayed on the form.
Any help appreciated!!
10-15-2004, 03:16 PM
I think you'll want to check out the ...
10-19-2004, 10:58 AM
Hi i read the ADO tutorial but i'm having some problems!
This is the code i have,
Private Sub Command1_Click()
Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Dim strPost As String
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Programming\Project\Database\Client.mdb;"
Set MyRecSet = MyConn.Execute("SELECT Postal Code FROM Customers")
Do Until MyRecSet.EOF
strPost = MyRecSet.Fields.Item("Postal Code").Value
Could someone point as to why its wrong i get the error msg Sytax error (missing operator)
10-19-2004, 12:11 PM
You didn't say which line was generating the error, but here's a couple of things I noticed:
You're adding the item of strName, yet you're getting strPost from the recordset.
Second, you need to add square brackets around the field name in the select statement because you're using a field name with a space in it. While Access allows spaces in field names, most real databases don't.
"SELECT [Postal Code] FROM Customers"