Update Query Works but Not In Macro

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

Guest

I have a form/subform where the form is used for record entry and I want the
record to immediately roll into the subform after user hits a button. The
button has these macro steps:

1. SaveRecord
2. OpenQuery - Runs an update query in order to copy the [Odline] date into
any null [Deadline] field
3. Requery - runs query named Log in order to refresh the subform by
receiving the newly entered record with the updated info from step 2
4. GoToRecord

The update query from step 2 works outside of the macro, but does nothing as
part of the macro. No errors occur when the button is depressed to kick off
the macro

The subform draws data from a query. There is no parent/child relationship
established between form/subform; as I want to show all records from Log.

Any suggestions, please?
 
Pete,

Could you please post back with the SQL view of your Update Query?

When you run the macro, do you get the action query confirmation message
"... about to update x record(s)" or whatever it is?
 
UPDATE CaseLog SET CaseLog.Deadline = [odline]
WHERE (((CaseLog.Deadline) Is Null));

I get no confirmation when this query is run by itself. Nor do I get one
during the execution of the macro.

Thanks for whatever help you can give me.

Pete


Steve Schapel said:
Pete,

Could you please post back with the SQL view of your Update Query?

When you run the macro, do you get the action query confirmation message
"... about to update x record(s)" or whatever it is?

--
Steve Schapel, Microsoft Access MVP
I have a form/subform where the form is used for record entry and I want the
record to immediately roll into the subform after user hits a button. The
button has these macro steps:

1. SaveRecord
2. OpenQuery - Runs an update query in order to copy the [Odline] date into
any null [Deadline] field
3. Requery - runs query named Log in order to refresh the subform by
receiving the newly entered record with the updated info from step 2
4. GoToRecord

The update query from step 2 works outside of the macro, but does nothing as
part of the macro. No errors occur when the button is depressed to kick off
the macro

The subform draws data from a query. There is no parent/child relationship
established between form/subform; as I want to show all records from Log.

Any suggestions, please?
 
Pete,

I am a bit lost here. Is Odline another field in the CaseLog table?
You said that the update query works outside of the macro. By this, do
you mean that you can confirm by looking at the data that blank
instances of Deadline have data inserted into them as expected? If so,
I would expect you to get a confirmation prompt when you run the query.
 
Pete,

I have just remembered that it is possible to turn off the confirmation
prompts, under the 'Edit/Find' tab via the Tools|Options menu. If
'Action Queries' is not ticked in the Confirm panel, please tick it
before further testing.
 
Steve, I turned on the option to receive warning regarding record updates. I
receive the warning both when running the macro separately, and also when
running the macro in response to the press of my GoToNextRecord button when I
am adding a new record.

Now. I believe I am closing in on the problem. The update query does not
work only when adding a new record using the form. If I delete a value
from the Deadline field in the subform, then press the GoToNextRecord button
on the form, I get the warning, and the query works fine.

I don't know if I've written this well enough. Hope you can wrangle through
it. Thanks for what you've done and for whatever time you still have to give
to this.

Pete
Steve Schapel said:
Pete,

I am a bit lost here. Is Odline another field in the CaseLog table?
You said that the update query works outside of the macro. By this, do
you mean that you can confirm by looking at the data that blank
instances of Deadline have data inserted into them as expected? If so,
I would expect you to get a confirmation prompt when you run the query.

--
Steve Schapel, Microsoft Access MVP
UPDATE CaseLog SET CaseLog.Deadline = [odline]
WHERE (((CaseLog.Deadline) Is Null));

I get no confirmation when this query is run by itself. Nor do I get one
during the execution of the macro.
 
Pete,

Are Odline and Deadline both fields in the CaseLog table? What is the
relationship between the form and the subform? Whatevent is the macro
running from? Is this on the main form or the subform? Sorry about the
questions - the information you have given so far is great... it's just
there isn't enough of it to be able so see what you've got there.
 
Back
Top