On 24 Jan 2007 10:40:35 -0800, "Cyberwolf" <cy**********@gmail.comwrote:
>OK, so how does the SQl know which record to look at? ANd, is my code
below correct?
Dim var1, var2, var3 As Variant
var1 = [Current TB].[Claim Number]
var2 = [Current TB].Amount
var3 = [Current TB].Store
strSQL = "UPDATE Chargebacks SET [Ref#]=" & var1 & ", " _
& "[Amount]=" & var2 & ", [Store]=" & var3 & ";"
The sql string looks Ok as long as var1, 2 and 3 are numeric. If any of them are
text they need to be wrapped in quotes. (I use Chr(34) for clarity).
eg [Store]=" & Chr(34) & var3 & Chr(34) & ";"
To have the update performed on specific record(s) you need to add a WHERE
clause to the string to define the record(s).
Assuming you wish to update the record currently displayed in your form, you
would add something like this -
strSQL = "UPDATE Chargebacks SET [Ref#]=" & var1 & ", " _
& "[Amount]=" & var2 & ", [Store]=" & var3 & _
& "WHERE MyIDField = " & Me.MyIDControl & ";"
Wayne Gillespie
Gosford NSW Australia