• Code help (Access2000)

    Author
    Topic
    #360594

    This is a code behind On Click event of a command button to open the amendment records for the current record in the current form.

    Private Sub Open_Amendment_Records_Click()
    On Error GoTo Err_Open_Amendment_Records_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = “DisplayAmendments”

    stLinkCriteria = “[tnum]=” & Me![tnum]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_Open_Amendment_Records_Click:
    Exit Sub

    Err_Open_Amendment_Records_Click:
    MsgBox Err.Description
    Resume Exit_Open_Amendment_Records_Click

    End Sub

    Now, What I was hoping to do was to remind the user that the form is empty if the current forms tnum field is empty. Im sure the following code is wrong but I was hoping someone would help me code something similar to this.

    stLinkCriteria = “[tnum]=” & Me![tnum]
    if Me![tnum] = Null
    then MsgBox

    Viewing 1 reply thread
    Author
    Replies
    • #543492

      Princess: Your code probably should read:

      If IsNull(me![tnum]) then ….

      HTH.

    • #543493

      Your first problem is this line;
      if Me![tnum] = Null

      To test for a Null condition you need the syntax:

      If IsNull(Me![tnum]) Then

      Check out the Help under “Properties that control how blank fields are handled” for a fuller description.

      HTH

    Viewing 1 reply thread
    Reply To: Code help (Access2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: