Results 1 to 10 of 10
  1. #1
    ashu.doc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    124

    Form/subform issue

    Hi
    I have a main form in which I have added a subform by subform wizard. When I am keeping the subform on the main form page and entering data in subform corresponding to the main form, the data is entering well in the table of main form and subform, but what I want to do is that I make a hyperlink or button on main form which opens that subform and then when I enter the data in subform it should go into the main form corresponding to it.
    I have tried to enter the data in subform on separate page but it is not going into main form corresponding to it. The relationship is something like this: and the form and subform I am talking about is Personal details (main form) and Conference (subform).
    Click image for larger version. 

Name:	untitled.JPG 
Views:	14 
Size:	74.1 KB 
ID:	9383
    PLease help
    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Don't understand. Why would entering data in subform cause data to enter into 'main' form? What is 'main form page'? If subform is on main form, then it is already 'open' - do you mean make it visible?

    Want to provide db for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ashu.doc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    124
    what I mean is that, can form and subform be on different pages like web? and can I put a hyperlink or button on main form to open subform? I have tried it but when I am entering the conference data attended by the surgeon, it is not going under the same surgeon ID, but when subform is on the same page as main form, everything is working fine, all the data for the conference is going under same surgeon ID.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Still don't know what you mean by 'page'.

    A form/subform arrangement will synchronize the related records because of the Master/Child links properties of the subform/subreport container control.

    Child forms opened independently to new record need code to pass the key value and populate foreign key field.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ashu.doc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    124
    ok i am sending you the database, have a look:

    Surgi-log 1.0.zip

    What I mean from "page" is F_Alldetails. So if you see there is a main form F_Alldetails. Then F_patientsdetails, F_surgicaldetails and F_opnotesandcomplications are subforms. Now if I want to add more subforms ( F_conferences, F_presentations) in the same page (F_alldetails) either I just have to show them as forms or as tab control. But I want to put a button or hyperlink on F_alldetails to open the subforms like F_conferences, F_presentations etc as a separate form. Also want to keep the data of forms and subforms related.

    Thanks

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    My previous reply still applies. In addition, if you want to open form with only records related to the record on F_Alldetails, need filter criteria, like:

    DoCmd.OpenForm "F_conferences", , , "SurgeonID=" & Me.SurgeonID
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    ashu.doc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    124
    Hi June
    You might be saying right but I cant understand your answer, if you have understood my question can you do that on my database forms and attach to your reply please.

    thanks.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Guess I don't understand what you want, because my suggestion is a simple code edit. If you want a button Click event to open another form that shows only records related to record on F_AllDetails, then use filter criteria in the OpenForm code. SurgeonID is the primary key of F_AllDetails so I assume that is the criteria to use when opening other forms.

    I am not going to try to modify and test your db. As I said, this is a simple edit. Create button, type code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    ashu.doc is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    124
    No its not that I want a button to open a form to show only records related to record on F_AllDetails. I want a button on F_alldetails to open a subform F_conferences and when I enter the data in conferences on any occassion it should populate the table of conferences with same surgeon ID from which that subform is opened from. and if you look in my database the table Personal details has SurgeonID as primary key is related as one to many with conference table ( SurgeonID as foreign key), so when I am creating that subform as linked one it is not populating the table as I want but when I am putting that subform in the main form itself, it is populating the table as I want, why is it like that?

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    A subform is created with a subform/subreport container control on another form/report. A sub is already 'open' when the parent opens. The subform/subreport container control synchronizes related records of main and sub with Master/Child links properties. The primary key of parent form will automatically save as foreign key in the subform record.

    If you are actually opening 'subform' independently then it is not really a 'subform' and it will not automatically synchronize records with 'parent' form. Synchronization would have to be controlled with code, hence my suggested VBA because I use only VBA (not macros).

    So which do you want - a subform or an independent form (the easy way or the hard way)?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Issue with using a datasheet in a subform
    By Meichmann in forum SharePoint
    Replies: 2
    Last Post: 01-17-2012, 07:26 AM
  2. relationship issue or filter by subform?
    By flwrgrl in forum Forms
    Replies: 9
    Last Post: 07-14-2011, 02:07 PM
  3. Subform Link Issue
    By danhartman in forum Forms
    Replies: 7
    Last Post: 07-06-2010, 07:14 AM
  4. How to solve this subform issue?
    By Patience in forum Forms
    Replies: 2
    Last Post: 06-28-2010, 07:09 AM
  5. Subform scrolling issue
    By Jerry8989 in forum Forms
    Replies: 4
    Last Post: 12-08-2009, 01:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums