Cross tab filter from Combo (1 Viewer)

Access_Help

Registered User.
Local time
Today, 13:51
Joined
Feb 12, 2005
Messages
136
I have a perfectly working cross tab and I want one of the filter fields to filter from a combo on one of the forms.

I am getting the error:

The Microsoft Access Database Engine does not recognize Forms![Form Name]![Comboname] as a valid field name or expresion.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:51
Joined
Oct 29, 2018
Messages
21,469
Hi. Basically, you'll have to declare the combobox as a parameter and specify its data type.
 

Access_Help

Registered User.
Local time
Today, 13:51
Joined
Feb 12, 2005
Messages
136
Thanks guys.

something like:
Dim comboBoxText As String

comboBoxText = Me.YourComboboxName.Column(1)


Will this work in SQL view..it sounds like VBA
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 21:51
Joined
Jan 14, 2017
Messages
18,217
You cannot reference e.g. Column(1) in query filter criteria.
In a select query you can set a variable equal to that value then create a user defined function to grab that value
Or use a tempvar.

However, as already explained, to do this in a crosstab query requires a parameter to be declared.
 

Access_Help

Registered User.
Local time
Today, 13:51
Joined
Feb 12, 2005
Messages
136
Great, thank you. It works!

PARAMETERS [Forms].[Form1].[txtCustomerID] Text (255);
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:51
Joined
Oct 29, 2018
Messages
21,469
Great, thank you. It works!

PARAMETERS [Forms].[Form1].[txtCustomerID] Text (255);
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom