An update query through VBA

  • Thread starter Thread starter Christian Davidsson
  • Start date Start date
C

Christian Davidsson

Hello,

I'm using a Access 2003 client to connect to a SQL server where all the data
is stored. I'm then using forms in order to control the data and I now need
to make an update query through one of the forms: user selects values in the
form, click the submit button and the data updates a table on the SQL
server.

I've got little knowledge of these solutions, but I'm more than eager to
learn (been using MDBs before).

I've noticed that I probably need a stored procedure to do an update query,
but how can I parse the values from the two combo boxes to that procedure?

The update query would look something like this:

UPDATE cont_units SET cont_units.unit_location = '90464-1',
cont_units.unit_moveDate = '2004-09-16 08:47:24' WHERE (((cont_units.unitID)
= '1001'));

This would be the code executed from the VBA in a MDB solution, but nothing
at all happens when runing this on the ADP:
"UPDATE tankar_units SET tankar_units.unit_location = '" &
unitLocation_combo.Value & "', tankar_units.unit_moveDate = '" &
dateTime_box.Value & "'" & " WHERE (((tankar_units.unitID) = '" &
unitID_combo.Value & "'));"
Any help on this would be deeply appriciated.


Thanks in advance,
Christian Davidsson
 
Back
Top