I want to run a delete query

Jon123

Registered User.
Local time
Today, 17:40
Joined
Aug 29, 2003
Messages
668
When this query runs I want the popup parameter to open and ask for an ChID number. User enters that number and it deletes that record. I cant figure out what to enter on the criteria line. I have [ChID] and that wipes all records. I tried = [ChID] and it does not run.

jim
 
Hard to say without seeing your SQL. Personally I would have the user enter the value on a form and have a button run a delete query that gets the value from there. That gives you more control over what they enter.
 
You know, I agree. More control I know how to do that. Works great. Thank you for the advice / input
 
Create a form like pbaldy recommended. Then:

Code:
Private Sub cmdDeleteCh_Click()
 If IsNull (Me.txtChID) Then
  MsgBox ("You must choose a ChID")
  Me.txtChID.SetFocus
 Else
  DoCmd.RunSql "DELETE FROM Ch WHERE ChID=[Forms]![frmDeleteCh]![txtChID]"
  MsgBox ("Ch deleted")
 End If
End Sub

This is just a quick response and untested (I'm still not really good enough to trust my code without much testing, but I think this should still help)

Ahhh, looks like prob solved above.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom