Microsoft
Software
Hardware
Network
Question : access update set
Hi,
I have a form called ABfrm1 this form is bound to a table called ABTable, the ABTable has the following fields:
id (autonum), firstname (text), lastname (text), age (number), rate (number) , total (text)
I have an unbound object (text) on my form named newtotal, this object has the following control source =[rate]*1.75.
I have a command button called cmdupdate at the bottom which when clicked i want it to update the current record and set the field total to the calculated value in the form object.
I was playing with some code but get the error message:runtime error 3464 datatype mismatch in criteria expression.
below the code:
Private Sub cmdupdate_Click()
strSQL = "UPDATE ABTable" & _
" SET ABTable.total = """ & Me.newtotal & _
""" WHERE ABTable.ID = """ & Me![ID] & """"
DoCmd.RunSQL strSQL
MsgBox "the new value is" & Me![total]
End Sub
any ideas on how i can achieve my goal?
Answer : access update set
If String ...
strSQL = "UPDATE ABTable" & _
" SET ABTable.total = " & Chr(34) & Me.newtotal & Chr(34) & _
" WHERE ABTable.ID = " & Chr(34)& Me![ID] & Chr(34)
Or a combination of the two...
mx
Random Solutions
Convert Sprite Sheets to Animations
Need Assistance Selecting Web Authoring Tool
DBNETLIB][ConnectionOpen(C<wbr />onnect()).<wbr />]Specified<wbr /> SQL server not found. MADNESS
Excel: Conditional formatting checking for unequal cells in portions of 2 wksts
vb.net - if string
How to open pdf in a new browser without save option
cannot delete shared calendar items in OWA exchange 2007
How do I convert a string with commas into a double?
Replace SBS Server 2003 SATA RAID hard drives with bigger ones
SQL String error. 'Too few parameters. Expected 1.'