Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code help (Access2000)

    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

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Columbus, Ohio, USA
    Posts
    286
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code help (Access2000)

    Princess: Your code probably should read:

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

    HTH.

  3. #3
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code help (Access2000)

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

    To test for a Null condition you need the syntax:
    <pre>If IsNull(Me![tnum]) Then</pre>


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

    HTH
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  4. #4
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code help (Access2000)

    Perfect,
    It works fine,
    Thank you guys..
    <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>

Posting Permissions

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