Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update query - number fields 1

Status
Not open for further replies.

JimmyRa

Programmer
Nov 20, 2003
4
GB
I am trying to do a docmd.runsql to update a database with a few number and date/time fields, from info in VBA variables. I keep getting 'syntax error in statement'

All the text fields work OK, using
" txtfld = '" & txtvar & "'" etc, but what should I do with " numfld = " ???? or " datefld = " ????

Thanks,
JimmyRa
 

"update table set num_field = " & val(txtNumber)


"update table set date_field = #" & format(txtDate,"dd-mm-yyyy") & "#"


should be what you want...?
 
Try something like this:
" txtfld = '" & txtvar & "'"
" numfld = " & numvar
" datefld = #" & datevar & "#"


Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top