Update Query SQL code in VB

  • Thread starter Thread starter chipmunkwhiz
  • Start date Start date
C

chipmunkwhiz

I would like to use an update query in some code. In
the past I've set a record source equal to SQL code, How
do I use something like:
"UPDATE [customer table] SET [customer table].[Delivery
Route] = "Alt-Tuesday"
WHERE ((([customer table].[Delivery Route])
="AltTuesday"));"
I just want to change values in a table based on the
users input.
Any help greatly appreciated.
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

== begin air code ==

dim strSQL as string

strSQL = "UPDATE [customer table] SET [Delivery Route] = " & _
"'Alt-Tuesday' WHERE [Delivery Route] = '" & _
Me!DeliveryRoute & "'"

CurrentDb.Execute strSQL, dbFailOnError

== end air code ==

This assumes this codes runs on a form that has a control named
"DeliveryRoute" and that there is a valid value in the control.

Note the use of single-quotes inside the string delimiters (double
quotes).

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQDUYxIechKqOuFEgEQJPfgCeNkPcsoyBHdIlA8tLqeT9e2Rp8ywAoOtW
d1vRwJg9v8T0QPNZ3HLVnnXq
=LqBo
-----END PGP SIGNATURE-----
 
Back
Top