why a column doesn't get updated

dai_lo

Registered User.
Local time
Today, 08:59
Joined
Jan 10, 2008
Messages
30
Hi,

I am trying to update fields in a table. everything get updated correctly except the field [Modify By]

DoCmd.RunSQL "UPDATE DOP_new SET [Modify BY] = '" & Itm_Logged_by & "' where [TrackingID] = " & Me![TrackingID] & ";"

DoCmd.RunSQL "Update DOP_new SET [Modify BY] = '" & Itm_Logged_by & "', [Reference #] = '" & Itm_reference & "', [TD Account #] = " & Itm_TD_Number_No & ", [Department] = '" & Itm_from_Department & "', [Barcode #] = " & Itm_BarCode & ", [Client Name] = '" & Itm_ClientName & "', [Deal Name] = '" & Itm_Deal_Name_Label & "' , [Document Date] = #" & Itm_Document_Date & "#, [Document Type] = '" & Itm_Document_Type & "', [Additional Comments] = '" & Itm_Additional_Commitments & "', [Number of Documents] = " & Itm_No_of_Document & ", [Box #]=" & Itm_Box_no & ", [Of #] = " & Itm_of_No & " WHERE [TrackingID]= " & Me![TrackingID] & ";"



the first statement doesn't update [Modify By] in the correct row #
I notice that the ME![TrackingID] in the first statemtn returns 1.. (please note, the ME![TrackingID] should be 71)

the second statement update everything in the correct row except the [Modify BY] doesn't get updated.

please advise.

Alice
 
Are you sure you have spelled the field name correctly? Is DOP_new a table or query?
 
Also, what type of object is Me!Tracking_ID? A textbox? A combobox? Where is that coming from? A subform? The main form? It's probably the source of the issue, but I can't be sure without knowing a little more.
 
Now with the answers to Moniker's questions we can zero in on the problem.
 
HI,

TrackingID is a column which has integer type. I should give you some background about my tool. I am creating an application which let users to select a record and view/open the selected record in another form. the following is how I called the second and display on the second form called "frm_Create"

DoCmd.OpenForm "frm_Create", acNormal, , "[TrackingID] = " & Me![TrackingID], acFormEdit

In the "frm_Create", users can make any data changes and save the changes into the table.

My problem is the statements/codes doesn't work as what i expected. thanks
 
So, is TrackingID something they can type in, or are they selecting it from a drop-down, or is it on a listbox or a datasheet view? I have a feeling it's a drop-down, listbox, or datasheet view.
 

Users who are viewing this thread

Back
Top Bottom