[AccessD] Subform data disappears on addition

Jim Hewson JHewson at karta.com
Tue Mar 20 13:22:31 CDT 2007


Have you tried to requery the subform then refresh the main form?
Don't requery the Assemblies form before requerying the subform.

Jim 
jhewson at karta.com
 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of ewaldt at gdls.com
Sent: Tuesday, March 20, 2007 1:15 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Subform data disappears on addition

No, it didn't make a difference. Thanks, though.

Any other ideas, Dan or others?

TIA.

Thomas F. Ewald
Stryker Mass Properties
General Dynamics Land Systems

------------------------------------------------------------
Date: Tue, 20 Mar 2007 08:33:12 -0500
From: "Dan Waters" <dwaters at usinternet.com>
Subject: Re: [AccessD] Subform data disappears on addition
To: "'Access Developers discussion and problem solving'"
                 <accessd at databaseadvisors.com>
Message-ID: <000901c76af4$4eac2ee0$0200a8c0 at danwaters>
Content-Type: text/plain;                charset="us-ascii"

Hi Tom,

This is something you can try:

Change the 2nd to last line of code to:

[Forms].[frmassemblies].[sfrmPartAssy].Form.Requery



Hope this helps calculating CG!
Dan Waters

-----Original Message-----
Subject: [AccessD] Subform data disappears on addition

I have a form (frmAssemblies) with a subform (sfrmPartAssy). The main form 

displays the main assembly table data (for one assembly), while the 
subform displays data from a query that combines the data from a parts 
(tblParts) table and the junction table (tblPartAssy) between the two, 
showing the applicable parts in the assembly shown in the main form.

I have a button on the main form that adds parts to the assembly; below is 

the code.

--------------------
Private Sub cmdAdd_Click()
Dim strSQL
strSQL = "INSERT INTO tblPartAssy SELECT " & _
    "[Forms]![frmAssemblies]![cboAssy] AS Assy, " & _
    "[Forms]![frmAssemblies]![cboRev] AS Rev, " & _
    "[Forms]![frmAddPartAssy]![cboPartNum] AS PartNum, " & _
    "[Forms]![frmAddPartAssy]![txtQuantity] AS Qty, " & _
    "[Forms]![frmAddPartAssy]![txtFindNum] AS FindNum;"

DoCmd.SetWarnings False
DoCmd.RunSQL (strSQL)
DoCmd.SetWarnings True

[Forms]![frmassemblies].Requery
[Forms]![frmassemblies].[sfrmPartAssy].Requery
[Forms]![frmassemblies].Refresh

End Sub
---------------------

Anyway, the problem is that when I add a part to the assembly, all of the 
data in the subform disappears; if I then go to another assembly, and then 

return to the original one, the data reappears, along with the added part. 

This happens for all assemblies EXCEPT the first one in the tblASSSEMBLIES 

table.  I'm fuzzy on the requery/refresh thing, so I tend to overuse them, 

just to be safe. Perhaps I'm causing a problem with that?

Since the data IS entered, the process does work, but having the subform's 

data disappear is a major irritation. Any suggestions on this would be 
appreciated.

Thomas F. Ewald



This is an e-mail from General Dynamics Land Systems. It is for the intended recipient only and may contain confidential and privileged information.  No one else may read, print, store, copy, forward or act in reliance on it or its attachments.  If you are not the intended recipient, please return this message to the sender and delete the message and any attachments from your computer. Your cooperation is appreciated.

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list