Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    DaveWms is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Location
    Dallas, TX
    Posts
    11

    Open another form from a subform...


    I know this has been addressed on this and other forums, but I don't completely understand the lingo.

    I have a database with two tables, two forms, and one subform.

    I have a 'form1' with 'subform' which shows the records from 'form2'. (The subform only shows

    I want to click a record in the subform, and have the form it's based on (form2) open to the record I clicked on in the subform.

    Can anyone explain how to do this in a low tech format? (I know just enough to really mess something up, but I'm the only one here that can turn on a PC.)

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Code behind the subform, can be form Click or DblClick event. Something like:

    DoCmd.OpenForm "Form2", , , "ID=" & Me.ID
    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
    thebigthing313 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    119
    Why do you need to open Form2 separately when Form2 is already displayed in Form1 in the Subform control?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    big, I think there are 3 forms - Form1 and subform then also Form2. OP wants to open Form2. Although could be wrong, I initially had the same question as you.
    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
    thebigthing313 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    119
    Ah, ok. I thought he meant 2 forms, one of which is used as a subform. Carry on

  6. #6
    DaveWms is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Location
    Dallas, TX
    Posts
    11
    Quote Originally Posted by thebigthing313 View Post
    Why do you need to open Form2 separately when Form2 is already displayed in Form1 in the Subform control?
    There is a whole page of data for each record in Form2 (too much to view in the Subform's datasheet view). The Subform shows just enough of each record to know which one we need (and there can be many records).

  7. #7
    DaveWms is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Location
    Dallas, TX
    Posts
    11
    I open Form1 (name and address of customer), and the Subform shows a single line representation of each invoice (with invoice number, and date). (Subform is in Form1.)

    From there we want to click on the target invoice number to open Form2 to see the complete invoice; What we did, if it's in warranty, who was the tech, etc.

    I know the basics, but don't know how to do the particulars.

    Thanks for any input.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Did you try suggestion in post 2?
    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
    DaveWms is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Location
    Dallas, TX
    Posts
    11
    I tried, but I'm not real sure where it goes (I'm in learning stage). VBA, SQL, Macro, Expression builder... I'm lost.

    (I'm glad I was working on a copy because I fouled up the form.)

    I tried a variation, and got an error saying something like 'can't change focus to _____'.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I suggested VBA code. There is macro equivalent.

    Select button in form design view. On Property Sheet event tab select [Event Procedure] in the Click event property then click the ellipsis (...) to open the VBA editor and type code into procedure.
    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.

  11. #11
    DaveWms is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Location
    Dallas, TX
    Posts
    11
    Thanks... I'll try it when I get back to the office.

  12. #12
    DaveWms is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Location
    Dallas, TX
    Posts
    11
    A question... "the VBA editor" is which of these: Macro Builder, Expression Builder, or Code Builder?

    I think it's the "Code Builder" but I'm just not sure.

    In the line: DoCmd.OpenForm "Form2", , , "ID=" & Me.ID is "Form2" the only thing I change to it's real name? Do I retain the quotes?

    Sorry I'm causing you to explain at a kindergarten level!

    Thanks for your help.

  13. #13
    DaveWms is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Location
    Dallas, TX
    Posts
    11
    This is what I put in the Subform cell's "On Click" property:

    Private Sub InvoiceNumber_Click()
    DoCmd.OpenForm "Invoices", , , "ID=" & Me.ID
    End Sub


    I got this message:
    Compile Error
    Method or data member not found.

    The debugger has .ID highlighted in "Me.ID"
    Last edited by DaveWms; 11-18-2014 at 07:49 AM. Reason: Clarification

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I used ID as an example. I don't know your database structure. Just as you used your actual form name, use your actual field names.
    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.

  15. #15
    DaveWms is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Location
    Dallas, TX
    Posts
    11
    Still can't get it to work; I'm sure it's me.

    I'm going to back off a bit, then get back at it again.

    Thanks for all the help.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Open a form based on a subform value
    By Fipper_SG in forum Programming
    Replies: 5
    Last Post: 09-19-2013, 02:53 PM
  2. Open form based on subform - possible
    By Richie27 in forum Access
    Replies: 2
    Last Post: 06-19-2012, 12:52 PM
  3. Open form with subform No Update
    By insane53 in forum Forms
    Replies: 1
    Last Post: 01-06-2012, 02:46 PM
  4. Replies: 1
    Last Post: 12-04-2011, 09:11 PM
  5. Replies: 1
    Last Post: 11-30-2010, 10:05 AM

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