Auto Fill prompt

G

Guest

I have a query which deletes based on a Bill of Ladding number which the user
is prompted for. The SQL Statement for this query looks like this:

DELETE [204HEADER].BILLOFLADDING, [204HEADER].*
FROM 204HEADER
WHERE ((([204HEADER].BILLOFLADDING)=[BILL OF LADDING]));

I then created a form which has a command button on it. When the user
clicks on this command button it will perform this query and give the user a
prompt for the bill of ladding number they want to delete.

What I would like is to have a text box on this form which the user can type
in the Bill of Ladding number which they want to delete and then when they
click on the command button they will either not receive the prompt for BOL
or the Prompt will come up but be pre-populated with the BOL that the user
typed in the text box.

Any help is greatly appreicated.
 
G

Guest

Put a text box on your form and reference in your query. Let's call it
txtBOL for example purposes:

DELETE [204HEADER].* FROM 204HEADER
WHERE ((([204HEADER].BILLOFLADDING)= '" & Me.txtBOL & "'));"

First, the first part of the query is redundant. Then, the above assumes
the field BILLOFLADDING in your table is a text field. If it is a numeric
field, this would be the correct syntax:

DELETE [204HEADER].* FROM 204HEADER
WHERE ((([204HEADER].BILLOFLADDING)= " & Me.txtBOL & "));"
 

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