C
cmledbetter
I hope I can sequence this so that you are not a as dizzy as I am attempting
to sort this out.
I have four forms built that use a unbound combo box named "EmpLookup" to
select an Emp_No to display Name and HireDate for the Emp_No selected then
display the linked fields in subform below. Linking no problem.
The combo box is based on qryEmpListActive (for all employees) or
qryEmpListActiveMgr which filters employee list to only departments owned by
login user. The main for has qryEmpListActiveOne as its record source. This
query has a function get_nmEmpNo() as criteria for records returned. (WHERE
(([Employee Data].Emp_No)=get_nmEmpLookup ())
The following code is included in Module 1
Dim nmEmpLookup As Integer
nmEmpLookup = ""
Public Function setEmpLookup(EmpLookup As Interger)
nmEmpLookup = EmpLookup
End Function
Public Function Get_nmEmpLookup() As Integer
Get_nmEmpLookup = nmEmpLookup
End Function
When the form opens I receive a error compiling message. I expected the form
to open with blank fields and once I select an Emp_No from the EmpLookup
combo box the After_Update event calls the following code.
Private Sub EmpLookup_AfterUpdate()
'function to set EmpLookup to variable nmEmpLookup
Call setEmpLookup
'Requery my form to place matching data on form
Me.Requery
End Sub
This is one of my first attempts at code to automate things in this DB that
has grown bigger than I had expected when I started this project.
Please advise
I have made this work by referencing the controls on each individual form
with [Forms]![MyForms]![EmpLookup] but this takes four differentqueries to
address the four different forms.
to sort this out.
I have four forms built that use a unbound combo box named "EmpLookup" to
select an Emp_No to display Name and HireDate for the Emp_No selected then
display the linked fields in subform below. Linking no problem.
The combo box is based on qryEmpListActive (for all employees) or
qryEmpListActiveMgr which filters employee list to only departments owned by
login user. The main for has qryEmpListActiveOne as its record source. This
query has a function get_nmEmpNo() as criteria for records returned. (WHERE
(([Employee Data].Emp_No)=get_nmEmpLookup ())
The following code is included in Module 1
Dim nmEmpLookup As Integer
nmEmpLookup = ""
Public Function setEmpLookup(EmpLookup As Interger)
nmEmpLookup = EmpLookup
End Function
Public Function Get_nmEmpLookup() As Integer
Get_nmEmpLookup = nmEmpLookup
End Function
When the form opens I receive a error compiling message. I expected the form
to open with blank fields and once I select an Emp_No from the EmpLookup
combo box the After_Update event calls the following code.
Private Sub EmpLookup_AfterUpdate()
'function to set EmpLookup to variable nmEmpLookup
Call setEmpLookup
'Requery my form to place matching data on form
Me.Requery
End Sub
This is one of my first attempts at code to automate things in this DB that
has grown bigger than I had expected when I started this project.
Please advise
I have made this work by referencing the controls on each individual form
with [Forms]![MyForms]![EmpLookup] but this takes four differentqueries to
address the four different forms.