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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update field on a table from a form 1

Status
Not open for further replies.

Gert

Programmer
Apr 9, 2000
240
DO
Hi All
I would like to update a field from a form with and upddate stateent.
I have put the code in a command clic event, but I got and error when I hit the command bottom

first "0.04" most be a field on the form
** I'm missing some statement li Dcmd or runsql, but I realy don't know how to use it.

**********************************************
Private Sub Comando4_Click()
UPDATE tblemp SET tblemp.[imp] = [salary]*0.04 WHERE (((tblemp.salary)>=3000));
End Sub

thanks in advance!!!
 
As I suppose, You must put an "DoCmd.RunSQL" before query.
So, it'll look like this:

Private Sub Comando4_Click()
docmd.runsql "UPDATE tblemp SET tblemp.imp =salary*0.04 WHERE tblemp.salary>=3000;"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top