Seach unbound Form

achi_ray01

New member
Local time
Today, 12:42
Joined
Nov 5, 2008
Messages
7
Please help me,

I am trying to make a search form by using unbound.

I have tblemployee & a form

There are unbound text boxes. What I want is when I entry ID employee in the txtIdEmployees then I enter, the other unbound text boxes will be update with the information from the tblEmployees,

Please be advice with the sample and some explaination,
:)
 

Attachments

I'm assuming the IdEmployee you're entering is supposed to match up with the field in your table named Badge_No. This code will fill in the textboxes on your unbound form:

Code:
Private Sub IdEmployees_AfterUpdate()
 Me.txtName = DLookup("Name", "tblEmployees", "[Badge_No] = '" & Me.IdEmployees & "'")
 Me.txtDept = DLookup("Departement", "tblEmployees", "[Badge_No] = '" & Me.IdEmployees & "'")
 Me.txtSec = DLookup("Section", "tblEmployees", "[Badge_No] = '" & Me.IdEmployees & "'")
 Me.txtPos = DLookup("Position", "tblEmployees", "[Badge_No] = '" & Me.IdEmployees & "'")
End Sub

Two things to note:

You have a field in your table named Name. This is a Reserved Word in Access, and should be changed to something else, such as EmployeeName. You can get away with using Name here, but sooner or later it's going to cause errors. Remember to change all references to it, including the code above, to the new name.

Also, you have a field named Departement. If this was a typo on your part, correct it in your table as well as in the code above, or at least be aware that it is spelled with the extra E.
 
thanks for the corrective and suggestions. it is a terrific answer
 

Users who are viewing this thread

Back
Top Bottom