Attempting to run An Append Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to run an append query using a macro and the, Open Query command
.. The Query is using information from a form to select the appropriate
records to add to a table. I am running the macro from the same form using
the after update condition.

The query will work manually but will not work using my method,,, Any Ideas
 
Dear Bud:

It sounds like the form being referenced by the query is open when you are
attempting this, but make sure of this, and that there is a value in the
control being referenced.

Tom Ellison
 
Hi Tom:
Thank you for your response, yes the form is open and there is a value inthe
control the control is a dropdown . I am attempting tou se the value in the
control to be the criteria in the action query. tHE RESULTS OF THE APPEND ARE
BEING USED TOBE THE SOURCE DATA FOR A SUB FORM ON THE SAME FORM . Maybe it
can't be done but it seems to almost work. If there is a any way I would
greatly appreciate the help.
 
Dear Bud:

I'm being very picky, but so is the computer!

OK, you confirm the form is open and the control has a value. You do not
confirm that your references to them are spelled exactly. I suppose you may
have checked that, but please look again. I say that because this is where
the problem lies 99.44% of the time (like the soap).

Tom Ellison
 
APPRECIATE YOUR RESPONSES, i HAVE CHECKED THE REFERANCES FOR SURE THEY ARE
ACCURATE, AND IF i KEEP THE FORM OPEN AND CHECK THE qUERY INDESIGN THEN IN
VIEW THE DATA IS THERE IT JUST DIDN'T PERFORM THE APPEND ACTION???
 
APPRECIATE YOUR RESPONSES, i HAVE CHECKED THE REFERANCES FOR SURE THEY ARE
ACCURATE, AND IF i KEEP THE FORM OPEN AND CHECK THE qUERY INDESIGN THEN IN
VIEW THE DATA IS THERE IT JUST DIDN'T PERFORM THE APPEND ACTION???
--

Please lay off the caps lock. It's hard to read and considered
impolite, because it looks like you're SHOUTING AT US.

You say:

tHE RESULTS OF THE APPEND ARE
BEING USED TOBE THE SOURCE DATA FOR A SUB FORM ON THE SAME FORM .

It sounds like you're trying to use the Append query as the
recordsource for a Form. This won't work! You can use an Append query
to perform an action (appending records to a table), or you can use a
Select query to select records for display (as the Recordsource for a
form), but you cannot use the same query for both purposes. Could you
post the SQL view of the query, if this doesn't resolve the issue?

John W. Vinson[MVP]
 
Thanks John:
Maybe it is the way I am explaining my self.
I will try again, I have a client table / form, On the form I have a drop
down control that selects a contract for that client. The contact type is
saved on the client table.

On the same form I have a sub Form that selects its data from a table. The
data in that table is put there using an, Append Query.

The Append Query is selecting its data from the Client Table and a Contract
Table
Linked by the contract type .
The clientID on the form is the criteria for the clientrid field in the
Append Query.

When the Append Query runs it appends components of the contract to a table,
that is the data I wish to display on the Sub Form.

It works if I manipulate everything manually.

What I am trying to do is run the Append Query using an EVENt after updating
the combo box.
Then Requery the subform to display the appended data using a Macro. I
beleave it is a matter of timing , but I can't find the correct sequence.

I have it running if I run the append and the requery Macro using a command
button . I cant find the way to have it auto work .

If this is a little clearer than mud any Ideas??

Thanks in advance


Bud
 
Then Requery the subform to display the appended data using a Macro. I
beleave it is a matter of timing , but I can't find the correct sequence.

I have it running if I run the append and the requery Macro using a command
button . I cant find the way to have it auto work .

If this is a little clearer than mud any Ideas??

Why use the macro at all, rather than just requerying in the same VBA
code which runs the append query?

I'd suggest that you try either or both of the following after
executing the query:

Application.Idle
DoEvents

This will pause execution until the append query has had time to
complete.

John W. Vinson[MVP]
 
Thanks John I will give it a try
--
Bud


John Vinson said:
Why use the macro at all, rather than just requerying in the same VBA
code which runs the append query?

I'd suggest that you try either or both of the following after
executing the query:

Application.Idle
DoEvents

This will pause execution until the append query has had time to
complete.

John W. Vinson[MVP]
 
Back
Top