Form Does not Display ReQueried Results (1 Viewer)

Ksabai

Registered User.
Local time
Today, 03:06
Joined
Jul 31, 2017
Messages
104
Iam using using TempVars to change the controls of the query, below is the code

TempVars.Add "tvyr", Trim(Me.cmbCropYear.Value)
Me.RecordSource = "SELECT * FROM [qryNNDocsDue]"
Me.Requery

But the result shown in the datasheet form is for all the Years. Am i writing something wrong here?

Pls advice
 

Ksabai

Registered User.
Local time
Today, 03:06
Joined
Jul 31, 2017
Messages
104
OpenQuery works fine and shows only the 2 rows that need to be displayed
 

onur_can

Active member
Local time
Today, 03:06
Joined
Oct 4, 2015
Messages
180
I did not understand why you needed to variable. If you want to take all the years, I think there is no need for any criteria.
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:06
Joined
Jan 23, 2006
Messages
15,379
Ksabai,
You have told us HOW you did something, and that the result of a query doesn't provide the answer you expected. You have not told us WHAT ("the something") you were trying to accomplish. And you did not show readers anything of qryNNDocsDue . More info please.
 

Ksabai

Registered User.
Local time
Today, 03:06
Joined
Jul 31, 2017
Messages
104
Iam trying to populate the results on a Split - data sheet view form. Will it work on a sub form view.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:06
Joined
Sep 21, 2011
Messages
14,301
So does qryNNDocsDue have a WHERE = [TempVar]![tvyr] clause?
 

Ksabai

Registered User.
Local time
Today, 03:06
Joined
Jul 31, 2017
Messages
104
Yes, it's a big access query. And does have 4 where clause using temp variable
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:06
Joined
Sep 21, 2011
Messages
14,301
This link infers you should be using parentheses with your method?

TempVars.Add

Personally I just use Tempvars("tvyr") = <whatever>

Also if you change a form recordsource, there is no need for a requery, you are just duplicating that request.?
 

Users who are viewing this thread

Top Bottom