do.command Button code - Form

bwalk037

Registered User.
Local time
Today, 00:21
Joined
Mar 20, 2009
Messages
22
Hello,

I have a form that has a list of Employee numbers and when you double click on an employee's number it opens another form that list all the accounts under that employee number.

Everything is working fine except there're a couple of duplicate employee numbers for the US and Canada so when you click on one of these numbers it returns both accounts for the employee number in the US and Canada.

This is the code I have right now to open the second account list form. The field that distinguishes US from Canada is called "Control Area", what do I need to add to this code so that it checks both the employee number and the "control area"?

Private Sub test_button_Click()
On Error GoTo Err_test_button_Click


Dim stDocName As String
Dim stLinkCriteria As String


stDocName = "Potential Loss Acct Detail Form"

stLinkCriteria = "[Credit_Rep]=" & Me![Credit Rep]
DoCmd.OpenForm stDocName, , , stLinkCriteria


Exit_test_button_Click:
Exit Sub



Thank you
 
If it's a numeric value:

stLinkCriteria = "[Credit_Rep]=" & Me![Credit Rep] & " And ControlArea = " & Me.txtControlArea

replacing with the correct names of course.
 

Users who are viewing this thread

Back
Top Bottom