Solved

save new record and sync subform

Posted on 2013-06-10
2
469 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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