Fields not updating

shaz123

Registered User.
Local time
Today, 14:09
Joined
Sep 8, 2006
Messages
81
I have an SQl statement which brings out the correct resutls however does not update the fields requested, Can any see what is worng with the followng code.

When testing the code the results are exactly wat i want, but they dnt seem to be updating the fields. Theere is a command button on the form, a list of orders appear on a listbox on the form which i have locked.

Code:
If StrPtr(stringy1) <> 0 Then
        Me.Person.SetFocus
            Sql = "Update [tbl_Delupdate] SET "
            Sql = Sql & "[Date of D Status] = '" & Stringy2 & "', "
            Sql = Sql & "[D Status] = 'Delivered' "
            Sql = Sql & "WHERE [Time of Transaction] = #" & datMaxDate & "# "
            Sql = Sql & "AND [Cylinder Barcode Label] = '" & stringy1 & "' "
            Sql = Sql & "AND [Works Order Number] = '" & Me.Person.Text & "' "
            
            MsgBox Sql
            Debug.Print Sql
            db.Execute (Sql)
 
Not sure whether I am getting this right. You want to update the contents of a table, based on the inputs in a input box (to which 'Me.Person.Text' refers)?

It would help to see the whole context of your above statement. Right now, just my two cents:

I usually refer to input fields in a Form by 'Me!Person' (without quotation marks), this returns the value of the field. Another option might be 'Screen.ActiveForm!Person'.

Then, I issue SQL statements with 'DoCmd.RunSQL Sql, 0'.

Always works for me, perhaps you might try that.

Cheers,
Alex
 

Users who are viewing this thread

Back
Top Bottom