Update text boxes on a form based on another text box entry

G

Guest

Thanks for reading !

I have a table that contains name, phone number and id number. I have a
form that displays that data. What I want to do is have the user enter in
their ID number, then based on that the field for phone number and name would
populate in the appropriate text boxes.

For instance if the user typed 12345 in the employee ID text box, the
afterupdate event would trigger something to go look for that number in
tblemployees and upon finding it would populate the phone number and name in
the other text boxes.

I'm not using a combo box only because not every employee may be in it...but
can if it makes it easier.

Does anyone have a link or some advice for this please ?

thanks for reading this.
 
G

Guest

hi,
you might try dlookup. relatively simple
field table filed control on form
DLookup("[PNumber]","tbl","[EmpID] ='" & Me!txtEmpID & "'"
DLookup("[name]", "tbl", "[EmpID] ='" & Me!txtEmpID & "'"
you can use this as the control source for the name
control and the phone number control
 
G

Guest

thank you for the info....I'm trying it and want to make sure I have this
correct:

The table name containing the data is 'employeedata'
The field in that table containing the id number is 'employeeidnumber'
The field in that table containing the name of the person is 'employeename'
The name of the text box on the form where the id number is typed in is
'mdidnumber'
The name of the text box where I want to put the looked(pardon the grammar)
up name is 'mdname'

So the expression placed in the Control Source of the 'mdname' text box
would be:
Dlookup("[employeeidnumber]","employeedata","[mdidnumber]"="&ME!mdidnumber &"

Just want to make sure because I can't get it to work and don't know if it's
a syntax issue or something else...

thanks very much
Chris


hi,
you might try dlookup. relatively simple
field table filed control on form
DLookup("[PNumber]","tbl","[EmpID] ='" & Me!txtEmpID & "'"
DLookup("[name]", "tbl", "[EmpID] ='" & Me!txtEmpID & "'"
you can use this as the control source for the name
control and the phone number control
-----Original Message-----
Thanks for reading !

I have a table that contains name, phone number and id number. I have a
form that displays that data. What I want to do is have the user enter in
their ID number, then based on that the field for phone number and name would
populate in the appropriate text boxes.

For instance if the user typed 12345 in the employee ID text box, the
afterupdate event would trigger something to go look for that number in
tblemployees and upon finding it would populate the phone number and name in
the other text boxes.

I'm not using a combo box only because not every employee may be in it...but
can if it makes it easier.

Does anyone have a link or some advice for this please ?

thanks for reading this.

.
 
G

Guest

You could also try using the combo box bound to your ID. Then create a
recordset with the information you would like retrieved. After update, that
information would fill into your unbound text boxes. I have a form that does
the same thing. However, I have not yet been able to determine how to add
that new "ID" and its associated values when they are not in the combo box.
My code comes from one of the access developers handbooks. It will work if
you would like to see it.

Chris said:
thank you for the info....I'm trying it and want to make sure I have this
correct:

The table name containing the data is 'employeedata'
The field in that table containing the id number is 'employeeidnumber'
The field in that table containing the name of the person is 'employeename'
The name of the text box on the form where the id number is typed in is
'mdidnumber'
The name of the text box where I want to put the looked(pardon the grammar)
up name is 'mdname'

So the expression placed in the Control Source of the 'mdname' text box
would be:
Dlookup("[employeeidnumber]","employeedata","[mdidnumber]"="&ME!mdidnumber &"

Just want to make sure because I can't get it to work and don't know if it's
a syntax issue or something else...

thanks very much
Chris


hi,
you might try dlookup. relatively simple
field table filed control on form
DLookup("[PNumber]","tbl","[EmpID] ='" & Me!txtEmpID & "'"
DLookup("[name]", "tbl", "[EmpID] ='" & Me!txtEmpID & "'"
you can use this as the control source for the name
control and the phone number control
-----Original Message-----
Thanks for reading !

I have a table that contains name, phone number and id number. I have a
form that displays that data. What I want to do is have the user enter in
their ID number, then based on that the field for phone number and name would
populate in the appropriate text boxes.

For instance if the user typed 12345 in the employee ID text box, the
afterupdate event would trigger something to go look for that number in
tblemployees and upon finding it would populate the phone number and name in
the other text boxes.

I'm not using a combo box only because not every employee may be in it...but
can if it makes it easier.

Does anyone have a link or some advice for this please ?

thanks for reading this.

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top