Filter a second form based on primary form

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.
 
G

Guest

You can add a where condition to the OpenForm command line

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

Guest

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.
 
G

Guest

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.
 

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