Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Location
    Hertfordshire, England
    Posts
    78

    Unhappy Unanswered: Simple bit of VBA code

    Hi

    I am just trying to write a little bit of VBA code to check a control on a report but it does not won't to work.

    I get the run-time error:

    You entered and expression that has no value

    The code is:

    Private Sub Report_Open(Cancel As Integer)

    If [Text175] Like "" Then
    MsgBox "text175 is empty!"
    Else
    MsgBox "text175 is not empty"
    End If

    End Sub

    Thanks in advance,

    Neil.

  2. #2
    Join Date
    Sep 2003
    Location
    Hertfordshire, England
    Posts
    78

    Re: Simple bit of VBA code

    Ignore i've sorted it now.

  3. #3
    Join Date
    Oct 2003
    Posts
    706

    Re: Simple bit of VBA code

    [i]
    I get the run-time error:
    You entered and expression that has no value

    Private Sub Report_Open(Cancel As Integer)

    If [Text175] Like "" Then
    Names, like Text175, can be tricky in Access if, as is usually the case, the name of the control is the name of a field. Such a name is technically ambiguous ("is it the name of a control or the name of a field?") and that can cause odd problems which are resolved by making the names slightly different.

    Beyond this, say assuming that ambiguity is not the problem, do you know that the name would have a value associated with it at the time that Report_Open runs? Both "open" and "close"-type event handlers are classic for surfacing problems of this kind if they exist.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

Posting Permissions

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