filter insists on parameter (1 Viewer)

pb21

Registered User.
Local time
Today, 11:59
Joined
Nov 2, 2004
Messages
122
I have a main form whose recordsource is a table that holds transaction data.
the pk to filter is taken from another open form and i want to filter on the group that was selected with the group number being a fk in the ftran table as a number.

the open event has the following code:

Dim GroupID As Integer
GroupID = Forms![group main screen form]!GroupID

Me.Filter = "group-DSN = 'GroupID'"

Me.FilterOn = True

it insists on asking for parameters for group and then asks for DSN




group-dsn is the field in the ftran table.

help would be much appreciated

regards
 

Laurentech

Registered User.
Local time
Today, 04:59
Joined
Nov 7, 2005
Messages
107
You need to change it to:

Me.Filter = "group-DSN = " & GroupID

Larry
 

pb21

Registered User.
Local time
Today, 11:59
Joined
Nov 2, 2004
Messages
122
hypen problem

I tried that Larry and it failed its almost as if the name of the field with the hypen is causing the problem ie group-dsn.

any ideas how to get around that?

regards
 

neileg

AWF VIP
Local time
Today, 11:59
Joined
Dec 4, 2002
Messages
5,975
It's a bad idea to use any punctuation in object names.

Why not use a query as the basis of your form instead of a filtered table?
 

maxmangion

AWF VIP
Local time
Today, 11:59
Joined
Feb 26, 2003
Messages
2,805
I have a main form whose recordsource is a table that holds transaction data.

To start with I would set the form based on a query rather than directly to a table. Once you've done this all you have to do is simply paste your reference Forms![group main screen form]!GroupID in the criteria row of the field in your query.
 

Users who are viewing this thread

Top Bottom