Filter a second form based on primary form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am designing a database for vehichle maintenance for my company. My data is
being stored on two tables, one for each vehicle and one for all service
operations on the vehicles. I am using an input form for the Vehicle database
and want to use a command button on my form to open a form based on my
Service table. However I want the command button to filter the Service form
to only entries for the vehicle shown on the the Vehicle entry form.
 
You can add a where condition to the OpenForm command line

Dim WhereCond As String
WhereCond = "vehichle = '" & Me.[vehichle] & "'"
Docmd.OpenForm "FormName",,,WhereCond
 
When I enterd in that string I am recieving a Syntax error (missing operator)
in Query expression. Can you double check that string you posted for me?
--
Kyle Miller
Norgasco, Inc.
Prudhoe Bay, AK


Ofer said:
You can add a where condition to the OpenForm command line

Dim WhereCond As String
WhereCond = "vehichle = '" & Me.[vehichle] & "'"
Docmd.OpenForm "FormName",,,WhereCond

--
\\// Live Long and Prosper \\//
BS"D


Kyle Miller said:
I am designing a database for vehichle maintenance for my company. My data is
being stored on two tables, one for each vehicle and one for all service
operations on the vehicles. I am using an input form for the Vehicle database
and want to use a command button on my form to open a form based on my
Service table. However I want the command button to filter the Service form
to only entries for the vehicle shown on the the Vehicle entry form.
 
Can you post your code?

But before make sure that the name are correct

WhereCond = "[vehichleFieldNameInTheTale] = '" & Me.[vehichleFieldNameInThe
Form] & "'"
Docmd.OpenForm "FormName",,,WhereCond

--
\\// Live Long and Prosper \\//
BS"D


Kyle Miller said:
When I enterd in that string I am recieving a Syntax error (missing operator)
in Query expression. Can you double check that string you posted for me?
--
Kyle Miller
Norgasco, Inc.
Prudhoe Bay, AK


Ofer said:
You can add a where condition to the OpenForm command line

Dim WhereCond As String
WhereCond = "vehichle = '" & Me.[vehichle] & "'"
Docmd.OpenForm "FormName",,,WhereCond

--
\\// Live Long and Prosper \\//
BS"D


Kyle Miller said:
I am designing a database for vehichle maintenance for my company. My data is
being stored on two tables, one for each vehicle and one for all service
operations on the vehicles. I am using an input form for the Vehicle database
and want to use a command button on my form to open a form based on my
Service table. However I want the command button to filter the Service form
to only entries for the vehicle shown on the the Vehicle entry form.
 
Back
Top