Save Code (1 Viewer)

jcruzAME

Registered User.
Local time
Yesterday, 18:29
Joined
Oct 5, 2011
Messages
135
Currently having an issue with something that was working Friday and now after replacing my SQL Server install that was having some issues, doesn't work anymore.

I've tried Me.Dirty = True and DoCmd.RunCommand acCmdSaveRecord to save the record before updating some recordsources on other forms. On Friday, the code would save the record and successfully and when I would run the code that re-queries the other forms the new record would show up.

Now, when I try to do the same thing the record doesn't show up in the table until after the form closes. The two lines of code above I've tried (with the If Me.Dirty = True Then Me.Dirty = False), and I can't get the new record to show up.

Any thoughts?
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:29
Joined
Feb 19, 2002
Messages
43,768
In what event is the save code? In what event is the code to open the other form?
 

jcruzAME

Registered User.
Local time
Yesterday, 18:29
Joined
Oct 5, 2011
Messages
135
Hi Pat, thanks for the response.

I have a Save button and a Close button. The save button checks to see if the form is Dirty, if it is I do Dirty = False.

Then it reruns the queries that are the record source of the other form (which is open but not visible). At the end of all that code I requery the non-visible form. Then the top form close and this one is set to visible again, and data should be refreshed.

When I step through the code, the new record doesn't appear in the table until the form is completely closed.

Last Friday this code was working for me, with a new record appearing in the requeried recordsource of the hidden form.

EDIT: Also, the save is located in the save button on click, and the requery code happens on unload. It was in the form close section.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:29
Joined
Feb 19, 2002
Messages
43,768
Are you sure the code is passing through the Me.Dirty code? The record should be found in the table after that executed.

Also, don't run the other queries. It is not necessary. They are run when you requery the form.
 

jcruzAME

Registered User.
Local time
Yesterday, 18:29
Joined
Oct 5, 2011
Messages
135
Thanks for the response Pat, I figured out what my problem was. One of the fields wasn't getting set when entering the information, but I'm not 100% sure how that was keeping the record from being saved.
 

Users who are viewing this thread

Top Bottom