A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Update Query: Enter Parameter Value



 
 
Thread Tools Display Modes
  #1  
Old December 31st, 2009, 03:29 PM posted to microsoft.public.access.queries
CC
external usenet poster
 
Posts: 238
Default Update Query: Enter Parameter Value

I'm trying to set a field to a value that is stored in a variable using an
update query in VBA (Access 2003). The query prompts the user to enter
parameter value, and the value of the variable displays in the pop up above
the input text box of the pop up.

The SQL is:
DoCmd.RunSQL "UPDATE temptbl_ImportedPlateOrders SET
temptbl_ImportedPlateOrders.GenSetName =" & strGenSetName

strGenSetName is the varialbe and displays the correct value in when I mouse
over it: strGenSetName = "G9999V00.txt"

Can someone identify what I'm doing wrong. Thanks in advance. You always
provide great advice.

  #2  
Old December 31st, 2009, 04:12 PM posted to microsoft.public.access.queries
RoyVidar
external usenet poster
 
Posts: 417
Default Update Query: Enter Parameter Value

CC wrote:
I'm trying to set a field to a value that is stored in a variable
using an update query in VBA (Access 2003). The query prompts the
user to enter parameter value, and the value of the variable
displays in the pop up above the input text box of the pop up.

The SQL is:
DoCmd.RunSQL "UPDATE temptbl_ImportedPlateOrders SET
temptbl_ImportedPlateOrders.GenSetName =" & strGenSetName

strGenSetName is the varialbe and displays the correct value in when
I mouse over it: strGenSetName = "G9999V00.txt"

Can someone identify what I'm doing wrong. Thanks in advance. You
always provide great advice.


It appears the GenSetName is a text field, then you need text
delimiters on the value

....GenSetName ='" & strGenSetName & "'"

or

....GenSetName =""" & strGenSetName & """"

--
Roy-Vidar


  #3  
Old January 1st, 2010, 02:08 PM posted to microsoft.public.access.queries
Bob Barrows
external usenet poster
 
Posts: 475
Default Update Query: Enter Parameter Value

CC wrote:
I'm trying to set a field to a value that is stored in a variable
using an update query in VBA (Access 2003). The query prompts the
user to enter parameter value, and the value of the variable displays
in the pop up above the input text box of the pop up.

The SQL is:
DoCmd.RunSQL "UPDATE temptbl_ImportedPlateOrders SET
temptbl_ImportedPlateOrders.GenSetName =" & strGenSetName

strGenSetName is the varialbe and displays the correct value in when
I mouse over it: strGenSetName = "G9999V00.txt"

Can someone identify what I'm doing wrong. Thanks in advance. You
always provide great advice.


As an alternative to Roy's advice, you can avoid the delimiter issue
entirely by using a querydef's parameters collection. Like this:

dim qdf as querydef 'you might have to add a reference to DAO
dim sSQL as string
sSQL="UPDATE temptbl_ImportedPlateOrders SET " & _
"GenSetName =[p1]"
set qdf=currentdb.createquerydef("",sSQL)
qdf(0) = strGenSetName
qdf.execute


--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.