Results 1 to 5 of 5
  1. #1
    vad77 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Location
    USA
    Posts
    105

    Open pop-up form from field value on Continuous form

    I want to open a pop-up form where the form opens up to the order id I clicked. The order_ID field is set to hyperlink and used VBA code on the click event to open the frm_NewOrders form.


    The problem is when I click on an order ID it opens the new orders form but in Add mode and not to the order ID I clicked.
    I tried two version of my code.

    Code:
    DoCmd.OpenForm "frm_NewOrders", , , "[order_id]" = Me.Order_ID
    
    DoCmd.OpenForm "frm_NewOrders", , , "[order_id]" = Me!Order_ID
    If I take out the Where condition from the event the new orders form will open up to the first record.

    Any ideas?? I did do a compact and repair but no change.

    Thanks!!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why do you have the order-id field set as Hyper Link? Just leave it as a text field and try it. Is the OrderID a numerical field? If not then you will need to surround the value with quotes.
    DoCmd.OpenForm "frm_NewOrders", , , "[order_id] = '" & Me.Order_ID & "'"

    In any event, your syntax is off a bit. Look at the example I posted.

  3. #3
    vad77 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Location
    USA
    Posts
    105
    My Order_ID field is an auto number field and is the primary key of the orders table. I made it hyperlink so the user will see that it is clickable. Fixed the syntax and now it works.

    DoCmd.OpenForm "frm_NewOrders", , , "[order_id] =" & Me.Order_ID


    Thanks for the reply.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That's great! I marked this thread as Solved for you.

  5. #5
    vad77 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Location
    USA
    Posts
    105
    Yeah, stupid syntax error. Now my next task, reporting.

    Thanks again!

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

Similar Threads

  1. Replies: 2
    Last Post: 11-09-2016, 05:54 PM
  2. Replies: 4
    Last Post: 06-02-2016, 09:03 AM
  3. Replies: 5
    Last Post: 12-09-2015, 11:28 AM
  4. Replies: 11
    Last Post: 11-28-2015, 09:58 PM
  5. Continuous search form won't open selected record in view form.
    By IncidentalProgrammer in forum Programming
    Replies: 20
    Last Post: 03-24-2015, 02:53 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