My query keeps asking the user to fill in the parameter (1 Viewer)

atrium

Registered User.
Local time
Today, 21:30
Joined
May 13, 2014
Messages
281
I run the first part below (using EmailTableMaintFrm) to ask for the email address to be deleted. The user enter an email into "Me.EmailToDeleteFld

I have this code in my program (EmailTableMaintFrm)
Me.EmailToDeleteFld = InputBox("Please enter the Email to be deleted ", "Email Deletion")
'----- Clients
DoCmd.SetWarnings False
DoCmd.OpenQuery "DeleteStandardCEmailQry"
DoCmd.SetWarnings True


My query is DeleteStandardCEmailQry below

DELETE ClientEmails.ClientId, *
FROM ClientEmails
WHERE ClientEmails.EmailAddress =[EmailTableMaintFrm].[EmailToDeleteFld];


Obviously this something very simple because the code is not complex.
Any help would be appreciated
 

Minty

AWF VIP
Local time
Today, 12:30
Joined
Jul 26, 2013
Messages
8,600
@Gasman is correct - a delete query deletes the whole record.
You want to update the field contents. Why not simply let the user edit the email field on a form?
 

atrium

Registered User.
Local time
Today, 21:30
Joined
May 13, 2014
Messages
281
I actually want to delete the whole record that matches the email address
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:30
Joined
Feb 19, 2002
Messages
32,221
Code:
DELETE ClientEmails.*
FROM ClientEmails
WHERE ClientEmails.EmailAddress = Forms![EmailTableMaintFrm]![EmailToDeleteFld];

Your form field reference was incorrect. I may have fixed it but I don't know since I don't have your database.

Whenever you run a query and Access prompts for a value and you did not intend to prompt the user, you can be 100% certain that you have some field name misspelled in the query.
 

jocph

Member
Local time
Today, 19:30
Joined
Sep 12, 2014
Messages
57
With the form EmailTableMaintFrm open, open the delete query in Design View, change it to Select Query then open in datasheet view. See if you get the record for the email add in EmailToDeleteFld.
 

Users who are viewing this thread

Top Bottom