Update Query Problem

N

NEWER USER

I have a continuous form with Filtered records. I want to update a single
field for all filtered records showing. My code is updating the current
record and not all filtered records. Any help appreciated.

Private Sub Update_Click()
On Error GoTo Update_Click_Err
Dim strSQL As String

strSQL = "UPDATE tblData SET tblData.ThreatStatus = 'Closed' WHERE
(((tblData.ID)=[Forms].[frmManagebyThreat].[ID]))"
DoCmd.RunSQL strSQL

Update_Click_Exit:
Exit Sub

Update_Click_Err:
MsgBox Err.description
Resume Update_Click_Exit

End Sub
 
G

Gina Whipp

NEWER USER,

You left me... <sniff sniff>

Change you strSQL line to... (Just removing the WHERE clause)

StrSql = "UPDATE tblData SET tblData.threatStatus = 'Closed'"

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
T

theDBguy

Hi,

Perhaps you could try something like:

strSQL = "UPDATE tblData SET tblData.ThreatStatus = 'Closed' WHERE " &
Me.Filter

(untested)
Hope that helps...
 

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