By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

Moving TempVar value into a table using a query.

P: 33
Hi,

I have a query that says:
Expand|Select|Wrap|Line Numbers
  1. Select Distinct Bids.EmpID, Bids.PosID, [tempvars]![reqnum] AS ReqNum From Bids;
The query works fine until I try to use it to populate a table, then the ReqNum field is always blank. The only thing I did different in the query was to place "INTO EmpBIDs" before the "From Bids" in the original query.

Is placing a tempvar value into a table using a query doable?

Thanks,
Shawn
Jan 23 '17 #1

✓ answered by jforbes

I don't use TempVars often, but I would think that the TempVar would be evaluated correctly.

You could try to create a Function to return your TempVar and then use the Function in your Query to see if your problem goes away.


VBA:
Expand|Select|Wrap|Line Numbers
  1. Public Function getReqNum() As Variant
  2.     getReqNum = TempVars.Item("reqnum")
  3. End Function

Query:
Expand|Select|Wrap|Line Numbers
  1. Select Distinct Bids.EmpID, Bids.PosID, getReqNum() AS ReqNum From Bids;

Share this Question
Share on Google+
1 Reply


jforbes
Expert 100+
P: 1,107
I don't use TempVars often, but I would think that the TempVar would be evaluated correctly.

You could try to create a Function to return your TempVar and then use the Function in your Query to see if your problem goes away.


VBA:
Expand|Select|Wrap|Line Numbers
  1. Public Function getReqNum() As Variant
  2.     getReqNum = TempVars.Item("reqnum")
  3. End Function

Query:
Expand|Select|Wrap|Line Numbers
  1. Select Distinct Bids.EmpID, Bids.PosID, getReqNum() AS ReqNum From Bids;
Jan 23 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.