Link to home
Start Free TrialLog in
Avatar of yddadsjd95
yddadsjd95

asked on

DoCmd.OpenForm not giving expected results

Great Day! I am trying to open a form with the following criteria

    stLinkCriteria = "[CustomerID]=" & Me![CustomerID] & " AND [CustomerVehicleID] = " & [Forms]!frmCustomerContactData!frmCustomerVehiclesSub.Form!VehicleMake

but no records show up and there should be 6. When I open the form with only the first criteria

stLinkCriteria = "[CustomerID]=" & Me![CustomerID]

all of the customer’s vehicles show, but I want to only open vehicles that = a specific vehicle make

I did try to open the form with the second criteria

stLinkCriteria = "[CustomerVehicleID] = " & [Forms]!frmCustomerContactData!frmCustomerVehiclesSub.Form!VehicleMake

but again, no records showed up. I placed a temporary field in the subform called ‘VehicleMake’ to see if the value that I expect shows up when the  subform (the one calling the form that I want to meet the specific criteria), and it does. Not sure where to go from here.

Thanks in advance for your help.

r/David

Thanks again for your assistance and any further help will be equally appreciated.

r/David

stLinkCriteria = "[CustomerID]=" & Me![CustomerID] & " AND [CustomerVehicleID] = " & [Forms]!frmCustomerContactData!frmCustomerVehiclesSub.Form!VehicleMake

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Hamed Nasr
Hamed Nasr
Flag of Oman image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yddadsjd95
yddadsjd95

ASKER

Thank you hnasr, while I was stripping the unnecessary objects from the database, I discovered that I needed to be looking at VehicleMakeID and not CustomerVehicleID. One of those rare occasions that someone pointed me in the right direction and I figured it out. Thanks .