Results 1 to 4 of 4

Thread: Runtime form loading

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    2
    We are currently in a spot. We have an ACCESS database with an extensive reports table. All Reports are developed in Crystal Reports. When we execute these reports each must have a form loaded to capture information to pass pass to the report.

    What we want to do is include the form name in the report table (this is trivial) and when we go to execute the program load the report specific form. This will make our ongoing maintenance a snap.

    We have tried everything to assign the load & show the form from this string assigned variable. Our problem is solved if someone knows how to get around the following:

    lform ="c:\abc\def.rpt"
    Set frmNew = NEW lfrom

    Help!!!!

  2. #2
    Guest

    Question Is this an Access question or a vb question

    Ok if vb the form is going to have to be a part of the vb project....in which case

    lform.Show (model whatever)

    However it would appear that you are doing something real stange..........a .rpt file is not equal to a .frm file.

    Please give more details..........

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    2
    What we are actually doing is storing the form name in the access table. For example in the table we would have a record with the report name, say tempReport.RPT. And the next field in this record would store the name of the form we need to load for obtaining the needed information. Say tempForm.frm.

    We the user selects the correct report to run, we obtain this information from the access table, and obtain the correct form needed to be loaded.

    The problem is this, we need to take the string containing the form name, assign this to a string variable and then somehow load the form with the same name as this string variable. For example:

    Dim tempForm as Form
    Dim formName as String

    formName = tempRcSet![formName]
    "Set tempForm = New formName"

    But this statement is not allowed. How Do I convert the string into a valid form Name so that I can load this form??

    Any ideas??????


  4. #4
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    You can't load a form from a string that contains the name. This is a common question and a major gripe with all us VB programmers.

    You will have to do a select case satement on the string and load the form accordingly.

    Code:
    Select Case strFormName
    
      strFormName = "From1"
        Set frmNew = Form1
    
      strFormName = "Form2"
        Set frmNew = Form2
    
    End Select
    Iain, thats with an i by the way!

Posting Permissions

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



Click Here to Expand Forum to Full Width