Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update field on form from table 1

Status
Not open for further replies.

ocottingham

Programmer
Feb 11, 2005
4
US
I am writing a position budget program. Among other fields, the form has the following fields from the Positions table:
posPlan
posGrade
posStep
posType
posPayRate.
If any of the first fields change on the form, I need to retrieve a new value from the GradeStep table, which has the following fields:
gsPlan
gsGrade
gsStep
gsType
gsRate.
As you can guess, the primary key for the GradeStep table is gsPlan, gsGrade, gsStep and gsType.

Should I use DLookUp? I'm trying to understand the function but am getting nowhere. Can anyone help?
 
Perhaps:
Dlookup("gsRate", "GradeStep", "gsPlan=" & Me.posPlan & " AND gsGrade='" & me.posGrade & "' AND gsStep=" & Me.posStep & " AND gsType='" & Me.posType & "'")
I have guessed at text (') and numeric fields. (There is an FAQ on DLookUp, which is more informative.)
 
Thank you. Will this code update posPayRate on the form and in my table? Do I put the DLookUp code in the ControlSource for posPayRate? Thanks for your help.
 
It depend on what you are doing. If posRate is an unbound control, you can use the line as a control source, but leave out Me. ([posPlan] not Me.posPlan). If posRate is a bound control, you will need to add a little code, including the line above, to the After Update events of the relevant controls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top