delete query (1 Viewer)

109bow

Registered User.
Local time
Today, 11:10
Joined
Oct 24, 2007
Messages
134
I'm sure i'm doing something very dumb!
I'm trying to create a delete query that deletes operators, [op name] and all their records from [train_tbl], when they are ticked as "left team" in the form [operator details].
I have spent all weekend on this, so any assistance would be very, very grateful.
Thanks
 

Attachments

  • training.accdb
    1.4 MB · Views: 55

109bow

Registered User.
Local time
Today, 11:10
Joined
Oct 24, 2007
Messages
134
Forgot to mention, the attached database has to opened using Ctrl+Enter as it is an extract of an ongoing database.
Thanks
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:10
Joined
Feb 19, 2013
Messages
16,604
why does it matter? you can filter out the 'left' operators in any query. And once deleted, if you every wanted to know how many people went on a training course, you'll never know, and pray no one doesn't click 'yes they are sure' in error.

but your basic code would be

currentdb.execute "DELETE * FROM train_tbl WHERE [Employee number] =" & me.[Employee number]

Your db has a number of basic flaws - spaces in field names, repeating data (op name repeated in train_tbl. relationships not defined, repeated horizontal column headings (i.e. is excel style, should be vertical - Sun, Mon etc in operators), numbers stored as text.
 

109bow

Registered User.
Local time
Today, 11:10
Joined
Oct 24, 2007
Messages
134
CJ_London, thanks for your reply. I will look at it again and try using a simple query, never thought of that! I know there are some basic flaws in the design, this is due to being a novice at access and building it "as I go".
Thanks
 

109bow

Registered User.
Local time
Today, 11:10
Joined
Oct 24, 2007
Messages
134
CJ_London, thanks for your help, a simple select query did the job. I should try and remember to look for the simple solution, not over complicate things! :)
 

Users who are viewing this thread

Top Bottom