Results 1 to 2 of 2

Thread: if isnull then

  1. #1
    Join Date
    Dec 2002
    Posts
    31

    Question Unanswered: if isnull then

    Dear All, I have a database about work done by different workers, that has in addition to the work table , a workers table, at the startup before opening the work form I want to check for the presence of workers if there is no names in the table entered yet I want to go to the form to rtegister new workers, else proceed
    i tried this code but it didn't work:

    If IsNull([tlstworkers].[worker] Then
    MsgBox "There is No current workers. At least one worker must be entered."
    DoCmd.OpenForm "frmtlstworkers", acNormal, "", "", acEdit, acNormal
    Else
    DoCmd.close acForm, "frmMainMenu"
    DoCmd.OpenForm "frmWorkRecord", acNormal, "", "", acEdit, acNormal
    End If

  2. #2
    Join Date
    Oct 2002
    Location
    NSW Australia
    Posts
    61
    You need to count the records first and then do your isnull on that value.

    try doing this:
    dim mycount as integer
    if isnull(DCount("[Worker]","tlstWorkers")) then
    DoCmd.OpenForm "frmtlstworkers", acNormal, "", "", acEdit, acNormal
    Else
    DoCmd.close acForm, "frmMainMenu"
    DoCmd.OpenForm "frmWorkRecord", acNormal, "", "", acEdit, acNormal
    End If

Posting Permissions

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