Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Posts
    225

    Unanswered: Run a report,by date and checkbox - code help

    I have created a form that has two text boxes on on my for that are called :

    WhichDaycodestartOEE

    WhichDaycodeendOEE


    i need to add to the code below, i want to ensure that the user has selected a daycode in the two boxes and a message box to appear if they are empty.

    but i then need to add abutton to my form so that i can run the report ensuring that the 2 date boxes and a line are selected.


    Option Compare Database
    Option Explicit

    Private Sub Options1()
    Select Case Options
    Case 1
    DoCmd.OpenReport "LME_H0", acViewPreview
    Case 2
    DoCmd.OpenReport "LME_H1", acViewPreview
    Case 3
    DoCmd.OpenReport "LME_H2", acViewPreview
    Else
    MsgBox "please select a line"
    End Select

    End Sub


    help please

  2. #2
    Join Date
    Feb 2004
    Posts
    199
    Select Case Options is this correct? what the Object is "Options"?
    You have event handler for a control named Options1 (not Options).

    Than to be shure that your textboxes aren't empty use code

    Code:
    IF Nz(WhichDaycodestartOEE,"")="" OR Nz(WhichDaycodeendOEE,"")="" Then 
        MsgBox "Fill the TextBoxes bla bla...",vbCritical + vbOKOnly, "Fill Error"
    Else
       .....
       YOUR SELECT CASE
       ......
    End IF
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  3. #3
    Join Date
    Mar 2003
    Posts
    225
    i have a option group of checkboxes

    my options group is called "Options1"

    think i might have mistyped in the post sorry.

    thanks for the code, i will try that.

Posting Permissions

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