Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Posts
    127

    Unanswered: Form - adding condition to command button

    I have a command button that runs a query, which uses a date range that the user enters….

    I need to write a piece a code where if there is no date entered… a message box appears saying “Please enter date range”…. If there is a date range entered, run command button as normal…

    Thanks in advanced….

    Attached is the form…
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    If Nz(Me.txtDate.Value, "") = "" Then
        MsgBox "No date range entered!"
        Exit Sub
    Else
        DoCmd.RunQuery "queryName"
    End If
    Oh and please stop attaching your database with every question - it's not always necessary and will just take up space!
    George
    Home | Blog

  3. #3
    Join Date
    Oct 2007
    Posts
    127
    cheers bud... will give it a go...

    many thanks

  4. #4
    Join Date
    Oct 2007
    Posts
    127
    thanks georgev

Posting Permissions

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