Subform linked by autonumber field in main form 
Author Message
 Subform linked by autonumber field in main form

I have a form with two subforms.  One of the subforms is linked to the
main form via an ID field that uses the random AutoNumber feature.  Of
course, when the main form opens, the subform shows no controls because
the ID field shows "(AutoNumber)".  But, I cannot figure out how to pass

this ID# to the subform once it is generated by Access.

I have tried a million things, such as:

Sub ControlOnMainForm_AfterUpdate()
    Forms!frmMainForm!frmSubform![ID] = Me![ID]
End Sub

And:

 Forms!frmMainForm.Refresh

And:

 Forms!frmMainForm!frmSubform.Requery

The subform _must_ be connected to the ID field because there is a
one-to-many relationship set up in the underlying tables.

I have also tried crazier things like making the subform visible and
enabled after update, but none of these worked.  I finally set up an all

new form with the embedded subform, and this works, but it requires the
user to move in and out of this new window instead of using their tab
button.

I have searched online help, an Access book, and dejanews and have found

nothing.  Any help would be WONDERFUL!!



Sat, 29 Jul 2000 03:00:00 GMT  
 Subform linked by autonumber field in main form

Hi,

On a properly linked form and subform, Access should automatically do the
linking so that when your focus moves to the subform and you start to enter
new records, Access automatically passes the Linking ID to the subform.

Check the LinkChildFields and LinkMasterFields property of the subform and
try setting the Cascade Update property of the relation.

HTH

--
Just my $.001
Dev Ashish
---------------

:I have a form with two subforms.  One of the subforms is linked to the
:main form via an ID field that uses the random AutoNumber feature.  Of
:course, when the main form opens, the subform shows no controls because
:the ID field shows "(AutoNumber)".  But, I cannot figure out how to pass
:
:this ID# to the subform once it is generated by Access.
:
:I have tried a million things, such as:
:
:Sub ControlOnMainForm_AfterUpdate()
:    Forms!frmMainForm!frmSubform![ID] = Me![ID]
:End Sub
:
:And:
:
: Forms!frmMainForm.Refresh
:
:And:
:
: Forms!frmMainForm!frmSubform.Requery
:
:
:The subform _must_ be connected to the ID field because there is a
:one-to-many relationship set up in the underlying tables.
:
:I have also tried crazier things like making the subform visible and
:enabled after update, but none of these worked.  I finally set up an all
:
:new form with the embedded subform, and this works, but it requires the
:user to move in and out of this new window instead of using their tab
:button.
:
:I have searched online help, an Access book, and dejanews and have found
:
:nothing.  Any help would be WONDERFUL!!
:
:
:



Sat, 29 Jul 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using a main form to control the edit properties of a subform using VBA

2. Subform needs to call VB subroutine in main form

3. subform disapppears after requerying main form

4. two subforms on a main form

5. Help in calling subform subroutines from the main form

6. Access 97 - Subform access triggers update for Main Form

7. Main form/subform?

8. Requery a Combo Box on a Subform When Filtering the Main Form in Access 7.0

9. Synchronizing DataRepeater as subform to main form

10. Make Link subreport with main report using fields (using API)

11. FindRecord - link main and sub forms with else

12. main linked form

 

 
Powered by phpBB® Forum Software