Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Apr 2003
    Location
    Washington, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Debug Problem (Access97)

    I am not familiar with VBA but this is the error "Me.Caption = Forms![Report Date Range].OpenArgs"
    when I run debug Invalid use of Null

    I'm including the total code below. If I need to supply more info please let me know. Thanks....

    Option Compare Database
    Option Explicit


    Private Sub Detail_Click()

    End Sub

    Private Sub Form_Load()

    End Sub

    Private Sub Form_Open(Cancel As Integer)
    Me.Caption = Forms![Report Date Range].OpenArgs
    End Sub
    Private Sub Preview_Click()
    If IsNull([Beginning Date]) Or IsNull([Ending Date]) Then
    MsgBox "You must enter both beginning and ending dates."
    DoCmd.GoToControl "Beginning Date"
    Else
    If [Beginning Date] > [Ending Date] Then
    MsgBox "Ending date must be greater than Beginning date."
    DoCmd.GoToControl "Beginning Date"
    Else
    Me.Visible = False
    End If
    End If
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Debug Problem (Access97)

    Is Report Date Range the form to which this code belongs?

    If so, use Me.Caption = Me.OpenArgs
    If not, I have found that the OpenArgs variable is always available when a form is opened, but it may get cleared later on. You might try

    Me.Caption = Nz(Forms![Report Date Range].OpenArgs, "Default Caption")

    (replace "Default Caption" by the caption of your preference)

  3. #3
    New Lounger
    Join Date
    Apr 2003
    Location
    Washington, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Debug Problem (Access97)

    THIS WORKED THANKS VERY MUCH.

    Me.Caption = Nz(Forms![Report Date Range].OpenArgs, "Default Caption")

Posting Permissions

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