Update query to remove values in field

Dinger_80

Registered User.
Local time
Today, 10:28
Joined
Feb 28, 2013
Messages
109
What I have a a form that my lab supervisor would use. That person selects the records that are to be modified and assigns work, completes work or otherwise updates the status of the records. One of the options is to mark a record as not having a sample here if it has already been marked as having been here. So essentially, I want to modify the record to change the sample arrival date and sample number field (which is a foreign key field) to null or empty. I have created a delete query that deletes the corresponding record just fine.I just am having difficulty updating the two fields mentioned above. When the supervisor selects the record the primary key for that record is also picked up so it is easy to know exactly what record to adjust. The query returns the information to be updated just fine, it just doesn't do that.

Here is the sql of the query. As I said, I don't care if the fields are empty or null. Also the fields aren't required.
Code:
UPDATE TestRequestTable SET TestRequestTable.SampleLocation = "", TestRequestTable.SampleArrivalDate = ""
WHERE (((TestRequestTable.TestRequestNumber)=[Forms]![LabScheduleForm]![TRNumberCombo]));
 
I just am having difficulty updating the two fields mentioned above.
Can you describe the exact symptoms of this difficulty in detail? Maybe you get an error, or a wrong result, or no result?
 
Mark,

To answer your question, nothing happens. I have tried to turn it into a delete query, I have tried it as an update query. I have entered in Null for the update to and nothing seems to make the record change. I have tried to select different records and I have had no success with any record having the information removed.
 
So I played around with the query a bit and what I think is going on is that since I have the database set up to lock records once a user opens them up, the update doesn't take affect. I tried to just run the query manually without any code and it brought up an error that explained how many problems in each of the categories it gave. The only error was in locked records. The query will run the update if I manually select the query and the form has a different record open.

What I need to do now is unlock the record to allow for the update to happen.
 

Users who are viewing this thread

Back
Top Bottom