Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Posts
    268

    Unanswered: Passing parameters to a form prior to opening

    I want to create a dynamic help screen for my users.

    They double click on a lable, which in turn would open a form with the control's name and a description of the information that it should contain.

    The form that would be driving this 'help' form has about 10 controls on it and I don't want to create 10 forms. i want to create one form and pass it the control name the the help context so the form knows how to populate itself.

    My initial thoughts were to store this data as a global variable accessible by both forms and on the load event for the subsequent form it would do a quick dlookup and load two label controls with the informaiton.

    But it seems that I should be able to pass some type of parameter to a form via the "docmd.openform" function.

    Anyone have any suggestions ideas on this one.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You could steal my "DebugStr()" function that I plant in every database. It's basically a form with a textbox on it that I populate AFTER the form opens using a little script.

    So we have a function called DebugStr (could just as easily be "OpenHelp" or what have you) that takes a string argument for display, opens the form and pushes the argument into a textbox:

    Code:
    Public Sub OpenHelp(strIn As String)
    Dim frm As Form
    
    DoCmd.OpenForm "yourHelpDisplayForm" 
    Set frm = forms!yourHelpDisplayForm  'You have to open the form before setting an object to it, annoying.
    
    With frm
       .lblYourHelpLabel.Caption = strIn
       .txtSomeOtherUsefulInfo = DLookup("whatever", "someHelpTable", "criteria = 'goes here'")
    End With
    End Sub
    The idea is to use the function as an accessor method to the forms controls. If you want to get tricky like me, you can modify it to check if the form is open, accept parameters for whether it's supposed to append or replace the information currently in the textbox etc...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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