Solved

save new record and sync subform

Posted on 2013-06-10
2
465 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 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 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