Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Posts
    7

    Unanswered: Using a macro to open forms-Advanced

    Ok, I hope that someone here can help me. I have created a from that goes off of a query. In this form I wanted to have it set up so that each company name is hyperlinked to go off a macro which will take you to a customer profile sheet (another form) just showing that customer. I created the macro and changed the field so it hyperlinked but the problem is that everytime I click on a name I get a pop up that says Enter Parameter value. If I enter the Customer ID everything works correctly. I want it to work so that once I click on the name that it opens the form and just shows the coresponding profile based on the customer ID. I have tried to look at everything and I have gone back over all my queries for mispellings and deleted fields and I can't find anything that works. I have attached the Where Condition below just to make sure that it looks normal. Does anyone know why this is happening.

    The Dr_NUM and the DRN are the linking fields which contain the same numbers.

    [DR_NUM]=[Forms]![Companies]![DRN]

  2. #2
    Join Date
    Aug 2003
    Posts
    15

    Re: Using a macro to open forms-Advanced

    The easiest way to do this is to just add a button that opens a form, the wizard will ask you if you want to display all items, or selected items. Then just choose your linked fields. If you prefer not to do it with buttons, but with coding a macro, it is much more complicated, but can be done.

    Try something like this:

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Requisition Form List"

    stLinkCriteria = "[Style]=" & "'" & Me![Style] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    *where [style] is my related field
    *stDocName is assigned the name of the form i am opening
    *stlinkcriteria is assigned the relationship the forms have

    let me know if this helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •