update a field in a record

  • Thread starter Dsperry101 via AccessMonster.com
  • Start date
D

Dsperry101 via AccessMonster.com

IHello all,
I have a table that has a field tblNewMwo.Sign_Off_by_Request that I want
to enter "Signed off" in the field when a field on a form is clicked.

Private Sub Any_Click()
Dim qrystr As String
qrystr = "Update tblNewMwo SET tblNewMwo.Sign_0ff_by_Request = 'Signed
off' WHERE tblNewMwo.Work_Order_Number = txtWorkOrderNumber"
DoCmd.RunSQL qrystr

End Sub
says record not updateable ??
 
A

Allen Browne

Could you not place the text box on your form (hidden if you wish), and then
just use:
Me.[Sign_0ff_by_Request] = 'Signed off'

If you really want to use an Update query, you will need to make sure there
are no uncommitted edits in the current form (to avoid concurrency issues),
and concatenate the number into the string:

qrystr = "Update tblNewMwo SET tblNewMwo.Sign_0ff_by_Request = 'Signed off'
WHERE tblNewMwo.Work_Order_Number = "& Me.txtWorkOrderNumber
 
D

Dsperry101 via AccessMonster.com

Tried changing a textbox with data.control source set to Sign_0ff_by_Request ,
it gives error "recordset not updateable"

Allen said:
Could you not place the text box on your form (hidden if you wish), and then
just use:
Me.[Sign_0ff_by_Request] = 'Signed off'

If you really want to use an Update query, you will need to make sure there
are no uncommitted edits in the current form (to avoid concurrency issues),
and concatenate the number into the string:

qrystr = "Update tblNewMwo SET tblNewMwo.Sign_0ff_by_Request = 'Signed off'
WHERE tblNewMwo.Work_Order_Number = "& Me.txtWorkOrderNumber
IHello all,
I have a table that has a field tblNewMwo.Sign_Off_by_Request that I
[quoted text clipped - 9 lines]
End Sub
says record not updateable ??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top