Simple one i guess?? (1 Viewer)

sasolini

Registered User.
Local time
Today, 23:55
Joined
Dec 27, 2004
Messages
61
hey

Can someone pls tell me how can i this:

I want to use a strnig as a criteria in a query, to use it like somekind of filter. And i realy do not know how to do that :( The name of a string i am using is StrFilter. I write it in criteria but i get msgbox to write it in and than i works finem but i want this to happend automaticly without that msgbox..thx
 

sasolini

Registered User.
Local time
Today, 23:55
Joined
Dec 27, 2004
Messages
61
From the form...

I have a button to run a report and on that button next to a code of report i have a strFilter = Me.Name

I hope this helps...
 

simongallop

Registered User.
Local time
Today, 22:55
Joined
Oct 17, 2000
Messages
611
In the query criteria instead of =StrFilter in the relevant field use: Forms![Form name here]![FieldName]
 

neileg

AWF VIP
Local time
Today, 22:55
Joined
Dec 4, 2002
Messages
5,975
Well there's one obvious problem. You have a control called Name which is a reserved word in VBA. Change this first to see if it solves the problem.

However, to use a control as a criterion in a query you need to use the syntax:
[Forms].[MyFormName].[MyControlName]

If you just type the name of the control, MyControlName, Acces won't know where to find it, and will generate a prompt, which is what is happening to you, I think.
 
Last edited:

neileg

AWF VIP
Local time
Today, 22:55
Joined
Dec 4, 2002
Messages
5,975
Harry said:
In the query criteria instead of =StrFilter in the relevant field use: Forms![Form name here]![FieldName]

You mean Forms![Form name here]![ControlName]
 

sasolini

Registered User.
Local time
Today, 23:55
Joined
Dec 27, 2004
Messages
61
thx guys for that...now what if my data come from combobox that have no control source? The idea that i have is to select somethin from combobox insted of write it...

thx
 

sasolini

Registered User.
Local time
Today, 23:55
Joined
Dec 27, 2004
Messages
61
thx...i find it...public string works just fine for me ;)
 

Users who are viewing this thread

Top Bottom