?
Solved

save new record and sync subform

Posted on 2013-06-10
2
Medium Priority
?
470 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 earned 2000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

800 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