Solved

save new record and sync subform

Posted on 2013-06-10
2
457 Views
Last Modified: 2013-06-18
I have a button that opens a new form, inserts a clientID and saves the record to show the InvoiceID. This does not seem to be enough for the subform as when I try to add a subform record it works until I try to requery the main form using Forms![frmInvoices].Requery. This brings the entire form to a new record.

Any ideas?


DoCmd.OpenForm "frmInvoices", acNormal, , , acFormAdd
Forms![frmInvoices]![ClientID] = Me.ClientID

Forms![frmInvoices].Refresh
Forms![frmInvoices].Dirty = False

Open in new window


Q_28152753.html
0
Comment
Question by:Shawn
2 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 39235095
In my response to your previous post, I removed the "Refresh" line, as it will do nothing for a new record, get rid of it.

In your previous post, you said nothing about a "sub-form", the code you provided above opens "another" form, not a sub-form.

Please explain (no code) what you want to do with this 'pop-up' data entry form "frmInvoices".  From your previous post, I assumed that you wanted to create a new record and save it, but I was a bit surprised that you wanted to save it without entering any of the invoice information.
0
 
LVL 1

Author Comment

by:Shawn
ID: 39235125
ok, hope this is clearer....
I create a new invoice by choosing a client in a popup window. The new invoice is created and the clientID is inserted. Works fiine up to here. In the subform I add products, prices, etc. This also works...until the after update which triggers an sp to total the products and insert/update main form with totals. If I start the procedure with a main form requery this doesn't work as it shows the InvoiceID as Null.

I did however just get it to work by switching from Requery to refresh. So I suppose I have the solution it would however be nice to better understand the workings of a new record and why requery would have this behaviour.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now