Updating Recordset (1 Viewer)

DRananahan

Registered User.
Local time
Today, 22:03
Joined
Jul 24, 2000
Messages
14
Hey everyone,

I have a form frmCustomerAE and a related form sfrmSignerCustomerAE.

On the frmCustomerAE form I have several fields. The first few are ObligorTypeCode, ObligorNum, and CompanyName. When the user enters a CompanyName, I have set the BeforeUpdate Property to open the sfrmSignerCustomerAE form for the CustomerID it is attached to.

My problem is this, when I try to add a record to the sfrmSignerCustomerAE form, I get a message that a related record in tblCustomer is required. However, if I move off of the record on frmCustomerAE and then return, it is ok.

I understand that I need to find a way to update the table before I open the signers form. Is there anyway to do this without moving off of the current record???

Thanks in advance,
Doug
 

dhoffman

Registered User.
Local time
Today, 22:03
Joined
Jul 11, 2000
Messages
69
I have the same problem but I have been putting off thinking about it. I don't really have any good ideas. But you may need to move the code that opens up the other table from the particular field's BeforeUpdate property and move it to the entire form's AfterUpdate property. I don't remember why now, but I don't think the AfterUpdate property of the field will help.
Then you might try setting the afterupdate property of the last field on the form to reposition the cursor back on one of the previous fields.
You know what, I'm beginning to wonder if I should be answering this post or not. I don't think my idesa are going to work very well.
PLEASE SOMEBODY ELSE HELP US
 

dhoffman

Registered User.
Local time
Today, 22:03
Joined
Jul 11, 2000
Messages
69
Yeah, forget what I said, doesn't work at all. As far as I can see, there is no way to get Access to truly save a new record until you leave that record. hmm
 

dhoffman

Registered User.
Local time
Today, 22:03
Joined
Jul 11, 2000
Messages
69
OK try this, on the afterUpdate property of the CompanyName: do this code before opening the other form:
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acPrevious

I know it's a little, how shall I put it, rinky dink, but it might work for you. Anyway, the record will be saved and, the cursor will be put back on that record before opening the other form.
 

Angello Pimental

Registered User.
Local time
Today, 22:03
Joined
May 9, 2001
Messages
92
Just put this piece of code before the code that opens up the sfrmSignerCustomerAE form in the Before_Update.

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

HTH

Angelo
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:03
Joined
Feb 19, 2002
Messages
43,371
The preferred save record command is:

DoCmd.RunCommand acCmdSaveRecord
 

dhoffman

Registered User.
Local time
Today, 22:03
Joined
Jul 11, 2000
Messages
69
Why is RunCommand preferrable to DoMenuItem? I just realized that even though there is no mention of either command in help if you look up SaveRecord, the wizards can make a button that does this action. However the wizards use the DoMenuItem version.
 

Users who are viewing this thread

Top Bottom