|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Unbound TextBoxes to Display Data From Access Tables
Hi all,
I'm trying to create forms in VB (2005 Express Edition) where after data is entered into a textbox, it checks the database for existing records. If there is an existing record, the other textboxes are to be populated with the data. I have done this in VBA for Access Forms, but I'm really new to VB. The following is what I used in VBA. For some reason, i can't seem to use DAO even though I've added the reference in VB. Can someone please teach me how to change the syntax so that I can code in VB? Code:
Private Sub cmboWPNO_AfterUpdate()
Dim DAOdb As Database
Dim DAOrs As DAO.Recordset
setDAODb = CurrentDb()
Set DAOrs = DAOdb.OpenRecordset("Select * from tblEEPersonal where WPNO = '" & Me!cmboWPNO.Column(0) & "'")
With DAOrs
Me.txtWPNO = .Fields("WPNO")
Me.txtName = .Fields("Name")
Me.txtEEID = .Fields("EEID")
Me.txtDOB = .Fields("DOB")
Me.optNationality = .Fields("Nationality")
Me.txtPPNO = .Fields("PPNO")
Me.txtPPExp = .Fields("PPExp")
Me.txtAgent = .Fields("Agent")
Me.txtAddHome = .Fields("AddHome")
Me.txtDateLast = .Fields("DateLast")
Me.txtUserLast = .Fields("UserLast")
End With
Me.txtWPNO.Visible = True
Me.txtWPNO.SetFocus
Me.cmboWPNO.Visible = False
Me.cmboWPNO = " "
End Sub
Would appreciate any help. I can't seem to find the full code anywhere
__________________
~Sharon~ |
|
#2
|
|||
|
|||
|
Probably there is no CurrentDB() I think that's access specific.
My recommendation is you use this opportunity to leave DAO behind and use ADO instead.
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
doug's right
its time you stared using ADO
i used the following steps (using ADO) -run an sql query just like the one you have -load the results in the controls ==>if you have problems, i will send you sample code |
|
#4
|
|||
|
|||
|
Thanks Doug and x_c4_4u,
I am trying to use ADO, but I cannot figure out the syntaxes. Would really appreciate if you could show me the sample code so that I can work backwards. Thanks a bunch! ![]() |
|
#5
|
|||
|
|||
|
You could start looking around here http://msdn.microsoft.com/library/e...adooverview.asp
|
|
#6
|
|||
|
|||
|
Thanks, Doug!
You're an angel!!! ![]() |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Unbound TextBoxes to Display Data From Access Tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|