Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246

    Unanswered: What's wrong with my If statement

    Hi,
    Have a slight issue that is bugging me and I'm obviously missing something obvious. When I try to execute the stement below with the "onClick" event I get an error message "Action or method requires form name argument".
    It works fine where the "Else" is true and also if I take out all of the "if "part and just have the first "DoCmd.OutPutTo" in the event. So what is wrong with the structure of this statement?

    Regards
    John



    Private Sub Export_Click()
    On Error GoTo Err_Export_Click
    If Me.Select_export.Column(0) = No Then

    DoCmd.OutputTo acOutputQuery, Me.Select_export.Column(3), acFormatXLS, , True

    Else

    DoCmd.OpenForm Me.Prompt_form, acNormal, , , , acWindowNormal

    End If

    Exit_Export_Click:
    Exit Sub

    Err_Export_Click:
    MsgBox Err.Description
    Resume Exit_Export_Click


    End Sub

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    Me.Select_export.Column(0) = No
    can never happen as far as i know unless you have a variable in scope called No or a field or control called No

    do you mean
    = False 'which is an intrinsic constant = 0 = the "no" response to a yes/no field
    or
    = "No" 'i.e. the literal string enn-oh

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Apr 2004
    Location
    ny, ny
    Posts
    224
    should it be else:

  4. #4
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Quote Originally Posted by izyrider
    Me.Select_export.Column(0) = No
    can never happen as far as i know unless you have a variable in scope called No or a field or control called No

    do you mean
    = False 'which is an intrinsic constant = 0 = the "no" response to a yes/no field
    or
    = "No" 'i.e. the literal string enn-oh

    izy
    HI,
    Thanks for the replies
    Me.Select_export.Column(0) is a combo box which I can see the value as Yes or No.

    Cheers
    John

Posting Permissions

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