open a specific form

actiondave

New member
Local time
Today, 01:46
Joined
Nov 3, 2006
Messages
1
I have a table that depending on a certain field in that table it will be able to open a specific form.

In other words I have multiple forms but only want a specific form opened when accessing a record if that record has a field with certain criteria

if that makes any sense

thanks
 
Try this in a module within the form (not tested). The parameter (strIn) is the value of the field to test:
Code:
Private Sub FormToOpen(strIn) As String

    Dim strtemp  As String

    strtemp = ""

    Select Case StrIn
        Case "1": strtemp = "frm1"
        Case "2": strtemp = "frm2"
        'etc.
        Case Else
            ' Do nothing, or something else
    End Select

    If Len(strtemp) Then
       DoCmd.OpenForm strtemp
    End If

    strtemp=""

End Sub
 

Users who are viewing this thread

Back
Top Bottom