rscott
Jun 30th, 1999, 06:37 AM
I know my problem may be extremely basic to some, but I am presenting my problem in hopes of a solution.
After a bit of research I have come across a two line bit of code to access "mdb" databases. My problem arises when I try to show this data in text fields...
I open the database with this bit of code.
--SNIP--
Private Sub Openthemdb()
Set MyDatabase = DBEngine.Workspaces(0).OpenDatabase("database1.mdb")
Set OurDB = MyDatabase.OpenRecordset("Rolodex")
'Now, we bind the controls to the text fields.
Assignthefields
End Sub 'Openthemdb
--SNIP--
After opening it - I am unsure as how to bind certain text fields to this database.
Here is how I went about it, but failed miserably.
--SNIP--
Private Sub Assignthefields()
SFName.DataField = "FirstName"
SLName.DataField = "LastName"
IAreaCode.DataField = "AreaCode"
SPhoneNum.DataField = "Phone"
SAddress.DataField = "Address"
SCity.DataField = "City"
SState.DataField = "State"
IZipCode.DataField = "ZipCode"
End Sub
--SNIP--
I have declared certain variables Public in hopes that this would alleviate my problem. No luck...
--SNIP--
Public SQL As String
Public MyDatabase As Database
Public OurDB As Recordset
--SNIP--
The text fields that I wish to attach to are seen above. I also have manually entered "OurDB" as the DataSource. Any help would be greatly appreciated.
After a bit of research I have come across a two line bit of code to access "mdb" databases. My problem arises when I try to show this data in text fields...
I open the database with this bit of code.
--SNIP--
Private Sub Openthemdb()
Set MyDatabase = DBEngine.Workspaces(0).OpenDatabase("database1.mdb")
Set OurDB = MyDatabase.OpenRecordset("Rolodex")
'Now, we bind the controls to the text fields.
Assignthefields
End Sub 'Openthemdb
--SNIP--
After opening it - I am unsure as how to bind certain text fields to this database.
Here is how I went about it, but failed miserably.
--SNIP--
Private Sub Assignthefields()
SFName.DataField = "FirstName"
SLName.DataField = "LastName"
IAreaCode.DataField = "AreaCode"
SPhoneNum.DataField = "Phone"
SAddress.DataField = "Address"
SCity.DataField = "City"
SState.DataField = "State"
IZipCode.DataField = "ZipCode"
End Sub
--SNIP--
I have declared certain variables Public in hopes that this would alleviate my problem. No luck...
--SNIP--
Public SQL As String
Public MyDatabase As Database
Public OurDB As Recordset
--SNIP--
The text fields that I wish to attach to are seen above. I also have manually entered "OurDB" as the DataSource. Any help would be greatly appreciated.