combining 2 tables in a delete query

G

Guest

i have written 2 separate queries to delete an individual record in 2
separate tables by employee name with a "like [enter name] " arguement. the
queries work as i need them to, but i combined them into a macro, and i need
to enter the employee name twice via dialouge box. is there a way to combine
both tables into the delete query, or is there a way for the macro to run the
separate queries with only 1 dialouge box entry for the employee name?

joe
 
R

Rick Brandt

crhp917 said:
i have written 2 separate queries to delete an individual record in 2
separate tables by employee name with a "like [enter name] "
arguement. the queries work as i need them to, but i combined them
into a macro, and i need to enter the employee name twice via
dialouge box. is there a way to combine both tables into the delete
query, or is there a way for the macro to run the separate queries
with only 1 dialouge box entry for the employee name?

joe

Self-prompting parameter queries (as you are seeing) have limited capability and
are one of the first things you outgrow as an Access developer. You virtually
never see these in serious apps.

What is better is to provide a form where the desired criteria text is entered
and then the query references that. Obviously, with that strategy many queries
running consecutively could all reference that same value on the form and by
using a form you can also allow that entry to be made from a ComboBox or ListBox
to make it easier and more accurate.

By the way, are you really using LIKE [parameter] for a DELETE query? You do
realize that if the user entered "*" that you would lose every record in your
table right? That's another problem with the self prompting parameter. You
have zero control over what the user might enter and what problems that might
cause.
 
G

Guest

i am the only person that has access to this delete query area.
would you be able to expand a little more on the form/query? how would the
info entered into the form be referenced by the query?

Rick Brandt said:
crhp917 said:
i have written 2 separate queries to delete an individual record in 2
separate tables by employee name with a "like [enter name] "
arguement. the queries work as i need them to, but i combined them
into a macro, and i need to enter the employee name twice via
dialouge box. is there a way to combine both tables into the delete
query, or is there a way for the macro to run the separate queries
with only 1 dialouge box entry for the employee name?

joe

Self-prompting parameter queries (as you are seeing) have limited capability and
are one of the first things you outgrow as an Access developer. You virtually
never see these in serious apps.

What is better is to provide a form where the desired criteria text is entered
and then the query references that. Obviously, with that strategy many queries
running consecutively could all reference that same value on the form and by
using a form you can also allow that entry to be made from a ComboBox or ListBox
to make it easier and more accurate.

By the way, are you really using LIKE [parameter] for a DELETE query? You do
realize that if the user entered "*" that you would lose every record in your
table right? That's another problem with the self prompting parameter. You
have zero control over what the user might enter and what problems that might
cause.
 
R

Rick Brandt

crhp917 said:
i am the only person that has access to this delete query area.
would you be able to expand a little more on the form/query? how
would the info entered into the form be referenced by the query?

Where you currently have...

like [enter name]

....use...

Forms!FormName!ControlName
 

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