Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 21st, 2004, 01:05 PM
Registered User
 
Join Date: May 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sub record not associating with Main record

In my database I have a Form/Subform setup that was
created through the wizard and it created a Toggle button
with a filter that would associate the child form with the
parent. Everything works fine - A new record is added and
the subrecord is created when the Toggle button is clicked.

Now the problem I'm running into has to do with a
Duplicate Record button I've created on the Parent Form.
The button creates a duplicate of the Main record, but
when the Toggle button is clicked, the sub record is not
associated with the main record.
I've tried setting the value of the sub record ID field to
the value of the main record ID field and it doesn't
work. I'll put the code below so you can see how it's
setup.
Please Help!! I hope this makes some sense.

Thanks - Ron
-------------------------------------------------
Tables-- [tblDMJobInfo].[DMJobID]
     1 to Many--->[tblDMJobTracking].[DMJobIDInfo]
Parent Form & ID field--[frmDMJobinfo].[DMJobID]
     RecordSource = [tblDMJobinfo]
Child Form & ID Field--[frmDmJobTrackingSub].[DMJobIDinfo]
     RecordSource = [tblDmJobTracking]
---------------------------------------
Sub ToggleLink_Click()'Code attached to Toggle on parent
form. This works fine.

On Error GoTo ToggleLink_Click_Err

    If ChildFormIsOpen() Then
        CloseChildForm
    Else
        OpenChildForm
        FilterChildForm 'See Filter sub below
    End If

ToggleLink_Click_Exit:
    Exit Sub
---------------------------------
Private Sub FilterChildForm() 'Doesn't work properly when
a record on the Parent form is copied and added

    If Me.NewRecord Then
        Forms![frmDmJobTrackingSub].DataEntry = True
        Forms![frmDmJobTrackingSub].DMJobIDinfo = Me.
[DMJobID]
    Else
        Forms![frmDmJobTrackingSub].Filter
= "[DMJobIDinfo] = " & Me.[DMJobID]
        Forms![frmDmJobTrackingSub].FilterOn = True
    End If

End Sub



 
Old August 31st, 2004, 09:21 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Ron V,
As I see ur problem it concerns that the relationship between form/subform only accepts one-to-many type. If u want a duplicate record on the form and on the subform, why not use a simple form with no subform ?
Hope I have not missunderstood ur problem.
Trully Penta.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete a record row, not just the record. Coby Access VBA 1 April 30th, 2007 06:29 AM
Last 7 Days Record prasanta2expert Access 1 October 23rd, 2006 05:38 AM
Add record mateenmohd Access 1 October 3rd, 2006 06:53 AM
how to add new record as first record in dataset hunzian78@yahoo.com ASP.NET 1.0 and 1.1 Professional 4 April 21st, 2006 05:23 AM
Record locking - user needs the next queued record cbtoolkit SQL Server 2000 0 December 6th, 2004 08:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.