One Query for two forms (1 Viewer)

basilyos

Registered User.
Local time
Yesterday, 17:43
Joined
Jan 13, 2014
Messages
252
hello


i have 2 forms and on update query based on user id
so i want to run the same query if form1 is open or form2


i put on criteria


[forms]![form1]![uid] or [forms]![form2]![uid]


but when run query form1 a dialog appear ask me for [forms]![form2]![uid]


and when run query form2 a dialog appear ask me for [forms]![form1]![uid]


mhy solutio is to make two seperated query but could i solve this problem with just one query
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:43
Joined
Sep 21, 2011
Messages
14,260
You don't say how you run the query.?
 

basilyos

Registered User.
Local time
Yesterday, 17:43
Joined
Jan 13, 2014
Messages
252
command on click from the opened form
 

Micron

AWF VIP
Local time
Yesterday, 20:43
Joined
Oct 20, 2018
Messages
3,478
Methinks your only other option besides 2 separate parametized queries would be to build the query sql with vba (code). By referring to form controls in the query, you've eliminated the possibility of having one query. Even if both forms were open and one hidden because the user shouldn't see it, it still wouldn't work because the invisible form controls would be empty.

Even then, as code you would require 2 procedures, one for each form, even if they were only one-liners that called the same public sub. Probably easier for you to have separate queries.
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:43
Joined
Sep 21, 2011
Messages
14,260

Users who are viewing this thread

Top Bottom