Results 1 to 14 of 14
  1. #1
    rdirosato is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8

    Load Record from report in form

    I'm an access newbie.

    Platform: Access 2007

    Question:
    I have a report that lists information from my db.
    I want to put an edit button at the end of each line item that when clicked will open a form called Help_Desk_Tickets with the proper record opened.
    I want to do this with a macro.

    I can get the button to load the form but cant figure out how to pass the right variable within the marco to display the correct record.

    ID.........Name..................Issue............ ............Edit Button
    01.........Mike Patton..........Needs New Mouse......[EDIT]
    02.........Tori Amos............Needs Speakers.........[EDIT]


    03.........Layne Stayley.......Accouunt Locked.......[EDIT]

    When [Edit] button is clicked from report I want it to load Help_Desk_Tickets form with proper record selected via MACRO

    Any help would be gratly appreciated.....

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sounds like you want this:

    BaldyWeb wherecondition

    If you want to stay with macros, you should see a where condition argument.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rdirosato is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8
    Thanks I looked at that and it seems abit over my head....

    ACTION:
    OpenForm

    ARGUMENTS:
    Form Name: Ticket_Input_Form
    View: Form
    Where Condition: [Forms]![Ticket_Input_Form]![ID]
    Data Mode: Edit
    Window Mode: Normal

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    While in that where condition row, hit F1 for context sensitive help. You need to specify the field name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    rdirosato is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8

    Other than Marcro?

    Is there an easier way to do this other than a macro?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    "Easier" is in the eyes of the beholder, but personally I always use VBA code, never macros. The one line of code from the link would be all you needed. If you haven't used code before, here's a primer:

    http://www.baldyweb.com/FirstVBA.htm

    By the way, there is no need to send a PM as well as ask on the thread. I get emails of responses to the thread, so I will always respond on the thread.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    rdirosato is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8

    My Apologies

    I know how to add an even procedure could you provide me the code to pull off the proper record....

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The link I gave in post 2 gives you the code; all you have to do is pick the appropriate one for the data type of your field, and change the various names to your own.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    rdirosato is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8

    Sorry if I'm a pest

    OK Lets just assume I'm an idiot.... Which I feel like now.... ;(

    In advance thanks again for all your help.....

    Table Name: Help_Desk_Main
    Form Name: Ticket_Input_Form
    Report Name: Open_Tickets

    So when i launch the report it brings up rows of results when I click an icon at the end of that report I want it to load the form Ticket_Input_Form with the current record selected.......

    Now say on a button I use an event procedure....

    What do I need to put in between the below

    Code:
    Private Sub Command13_Click()
    
    End Sub
    Sorry if I'm annoying you... I am a noob to access

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Well, you haven't mentioned the data type of the field, so I'll assume numeric. See if this works:

    DoCmd.OpenForm "Ticket_Input_Form", , , "ID = " & Me.ID

    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    rdirosato is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8
    Thank you so very much....

    Worked like a champ.......

    And yes it was a number..... auto number primary key to be exact...

    Dude thanks again

    Code:
    Private Sub Command132_Click()
    DoCmd.OpenForm "Ticket_Input_Form", , , "ID = " & Me.ID
    End Sub
    pbaldy is the man

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    LOL! No problem, and welcome to the site by the way.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    rdirosato is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8

    Glitch in the above code

    If the form isn't open the above code won't work.
    I tried this below and it seems to work if the form is opened or closed

    Code:
    Private Sub Command132_Click()
    DoCmd.OpenForm "Ticket_Input_Form"
    DoCmd.OpenForm "Ticket_Input_Form", , , "ID = " & Me.ID
    End Sub
    Thanks to baldy

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Huh? I use that code all the time, and always on forms that aren't open. Can you post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Change the text box color on form load
    By mikec in forum Programming
    Replies: 2
    Last Post: 03-01-2010, 11:47 PM
  2. On Load, form not visible
    By Bruce in forum Forms
    Replies: 15
    Last Post: 02-24-2010, 04:06 PM
  3. Print a specific record report from a form
    By cynthiacorley in forum Reports
    Replies: 27
    Last Post: 02-08-2010, 06:34 AM
  4. Replies: 3
    Last Post: 01-14-2010, 08:32 AM
  5. Find data, load data, and save as a new record
    By hawzmolly in forum Access
    Replies: 0
    Last Post: 10-05-2008, 03:18 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