Pass Filter Value to Another Form

G

Gwen H

I have a form, "MainMenu", with a list box "empList". The list box has 3
columns. I want to pass the value in the third column of empList (called
empID) to another form. The MainMenu form has a button that opens the second
form, using this filter criteria:

stLinkCriteria = "[empID]=" & Me![empList]

The second form, "Enter_View_Requests," has its data entry property set to
No, so that if no records are found for that employee, nothing is displayed
in the form fields. I want to set the empID field on Enter_View_Requests
equal to the empID column on MainMenu. Below is the code I tried, but
debugger flagged it and it does not work.

If Me.RecordsetClone.RecordCount = 0 Then
Me.empID.Value = Forms!MainMenu!empList.empID
Me.FilterOn = True
EndIf

Thanks for your help!

GwenH
 
M

mscertified

Normally you refer to the columns of a list box with a .Column(n) syntax.
Check Access Help for how to refer to Listbox columns.

Dorian
 
G

Gwen H

When I use

Me.empID.Value = Forms!MainMenu!empList.Column(2)

I get this error:

You can't assign a value to this object.

Any ideas?

Thanks!
GwenH

mscertified said:
Normally you refer to the columns of a list box with a .Column(n) syntax.
Check Access Help for how to refer to Listbox columns.

Dorian

Gwen H said:
I have a form, "MainMenu", with a list box "empList". The list box has 3
columns. I want to pass the value in the third column of empList (called
empID) to another form. The MainMenu form has a button that opens the second
form, using this filter criteria:

stLinkCriteria = "[empID]=" & Me![empList]

The second form, "Enter_View_Requests," has its data entry property set to
No, so that if no records are found for that employee, nothing is displayed
in the form fields. I want to set the empID field on Enter_View_Requests
equal to the empID column on MainMenu. Below is the code I tried, but
debugger flagged it and it does not work.

If Me.RecordsetClone.RecordCount = 0 Then
Me.empID.Value = Forms!MainMenu!empList.empID
Me.FilterOn = True
EndIf

Thanks for your help!

GwenH
 
G

Gwen H

Found the answer - all I need to do is set the empID field on
Enter_View_Requests equal to the value on the MainMenu form:

Me.empID = [empID] & Forms!MainMenu![empList]



mscertified said:
Normally you refer to the columns of a list box with a .Column(n) syntax.
Check Access Help for how to refer to Listbox columns.

Dorian

Gwen H said:
I have a form, "MainMenu", with a list box "empList". The list box has 3
columns. I want to pass the value in the third column of empList (called
empID) to another form. The MainMenu form has a button that opens the second
form, using this filter criteria:

stLinkCriteria = "[empID]=" & Me![empList]

The second form, "Enter_View_Requests," has its data entry property set to
No, so that if no records are found for that employee, nothing is displayed
in the form fields. I want to set the empID field on Enter_View_Requests
equal to the empID column on MainMenu. Below is the code I tried, but
debugger flagged it and it does not work.

If Me.RecordsetClone.RecordCount = 0 Then
Me.empID.Value = Forms!MainMenu!empList.empID
Me.FilterOn = True
EndIf

Thanks for your help!

GwenH
 

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