Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Access
3rdpartyusrgrp
access
activexcontrol
adp.sqlserver
commandbarsui
conversion
dataaccess.pages
developers.toolkitode
devtoolkits
externaldata
forms
formscoding
gettingstarted
internet
interopoledde
macros
modulescoding
modulesdaovba
modulesdaovba.ado
multiuser
odbcclientsvr
queries
replication
reports
security
setupconfig
tablesdbdesign
  
 
date: Mon, 6 Oct 2008 21:18:00 -0700,    group: microsoft.public.access.queries        back       


Update does not read content of variable   
When this update query runs the it does not recognize the value of integer 
variable vno in the WHERE field.  A window opens labeled vno and asks for a 
value.  If a value is entered the update complete and it goes to the next 
loop.  what is need to make the content of vno available.  The s syntax of 
the update string was copied from an update query with the vno replacing a 
numeric constant.

While Cnt < Maxseq
Rno = Int(Rnd() * 100)
vno = Cnt
SQL1 = "UPDATE StudentTable SET StudentTable.SortFld = Int(Rnd() * 100) 
WHERE ((StudentTable.SeqNO = vno))"
DoCmd.RunSQL SQL1
Cnt = Cnt + 1
Wend
-- 
Al C
date: Mon, 6 Oct 2008 21:18:00 -0700   author:   AL .(donotspan)

Re: Update does not read content of variable   
Try concatenating the variable into the string:

    "...WHERE (StudentTable.SeqNO = " & vno & ")"

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"AL" <albert_c26@msn.com.(donotspan)> wrote in message
news:93AC36C8-8D19-4F8F-81BA-B7D6B86A972F@microsoft.com...
> When this update query runs the it does not recognize the value of integer
> variable vno in the WHERE field.  A window opens labeled vno and asks for 
> a
> value.  If a value is entered the update complete and it goes to the next
> loop.  what is need to make the content of vno available.  The s syntax of
> the update string was copied from an update query with the vno replacing a
> numeric constant.
>
> While Cnt < Maxseq
> Rno = Int(Rnd() * 100)
> vno = Cnt
> SQL1 = "UPDATE StudentTable SET StudentTable.SortFld = Int(Rnd() * 100)
> WHERE ((StudentTable.SeqNO = vno))"
> DoCmd.RunSQL SQL1
> Cnt = Cnt + 1
> Wend
> -- 
> Al C
date: Tue, 7 Oct 2008 13:02:46 +0800   author:   Allen Browne lid

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us