Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IsNull Combo (A2000)

    This is the part I hate.
    I'm sitting here ironing out code, removing blank lines and 'Adding descriptions.

    Checking if what happens when null values etc.

    This one is stumping me.

    Private Sub cmbInsurerCode_DblClick(Cancel As Integer)
    If IsNull([cmbInsurerCode]) Then MsgBox "No Insurer Details"
    Dim LinkCriteria As String
    LinkCriteria = "[insurercode] = '" & Me!cmbInsurerCode.Text & "'"
    DoCmd.OpenForm "frminsureradmin", , , LinkCriteria
    End Sub

    If the combo is null or "" how do I stop the form opening.

    Dave

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

    Re: IsNull Combo (A2000)

    Use Exit Sub :
    <pre>Private Sub cmbInsurerCode_DblClick(Cancel As Integer)
    If IsNull([cmbInsurerCode]) Then
    MsgBox "No Insurer Details"
    Exit Sub
    End If
    Dim LinkCriteria As String
    LinkCriteria = "[insurercode] = '" & Me!cmbInsurerCode.Text & "'"
    DoCmd.OpenForm "frminsureradmin", , , LinkCriteria
    End Sub</pre>

    Francois

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IsNull Combo (A2000)

    You know.
    I could sit for hours just posting these little glitches.
    Hope to be of service to others at some time.
    Thanks Francois.

    Dave

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: IsNull Combo (A2000)

    Or is you are a structured programming afficianado:

    Private Sub cmbInsurerCode_DblClick(Cancel As Integer)
    Dim LinkCriteria As String
    If IsNull([cmbInsurerCode]) Then
    MsgBox "No Insurer Details"
    Else
    LinkCriteria = "[insurercode] = '" & Me!cmbInsurerCode.Text & "'"
    DoCmd.OpenForm "frminsureradmin", , , LinkCriteria
    End If
    End Sub

    (For those who don't grok structured programming, it doesn't allow bailouts like "Exit Sub" in the middle of a routine.)
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Blacktown, Sydney, New South Wales, Australia
    Posts
    175
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: IsNull Combo (A2000)

    'grok' ????

    Ah Yes a Robert Heinlen fan.

Posting Permissions

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