Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parameter optional? (97)

    Parameter optional?
    If I set up a query with some of its fields criteria set equal to a form, how can I tell the query that the form is optional (or in other words, that the parameter is optional)

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Parameter optional? (97)

    With the Northwind.mdb's Isloaded function write a new function:
    <pre>Function IsLoaded(ByVal strFormName As String) As Boolean
    ' Returns True if the specified form is open in Form view or Datasheet view.

    Const conObjStateClosed = 0
    Const conDesignView = 0

    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
    If Forms(strFormName).CurrentView <> conDesignView Then
    IsLoaded = True
    End If
    End If
    End Function


    Function CheckForm() As String
    If IsLoaded("MyForm") Then
    CheckForm = Forms!Myform!MyControl
    Else
    CheckForm = "*"
    End If
    End Function


    </pre>


    In the criteria of you query use :
    Like CheckForm()
    Francois

Posting Permissions

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