Results 1 to 16 of 16

Thread: Opening a Report reliably-Not my SQL statement?

Threaded View

  1. #1

    Thread Starter
    Addicted Member Bazzlad's Avatar
    Join Date
    Jun 2003
    Posts
    227

    Unhappy Opening a Report reliably-Not my SQL statement?

    It's in VBA (Access)
    I have a report which grabs data off an open form *Through a query*
    [Query grabs data off open form-report shows Querys data]

    The problem is it doesn't always open, I get messages like:

    access can't find the field FORMS reffered to in your expression
    or
    the open report action was cancelled.

    The problem is, it seems to be totally random, it won't work, and then I'll reopen and it will/won't. There doesn't seem to be any way to 100% guarentee opening it,,,
    and it needs to be.
    The code I'm using:

    VB Code:
    1. 'Checks if needed field is filled in
    2.     If not Datebox.Value >= "" Then
    3.     MsgBox "Please enter a Date"
    4.     Datebox.SetFocus
    5.     Else
    6.     'Checks if the form sale is the only open form
    7.     For Each frm In Forms
    8.     If frm.Name <> "frmsale" Then
    9.     DoCmd.Close acForm, frm.Name
    10.     End If
    11.     Next frm
    12.     'Hides the listbox, goes forward a record then
    13.     'backwards a record-to make sure the data is
    14.     'saved then re shows the listbox
    15.     List106.Visible = False
    16.     DoCmd.GoToRecord , , acNext
    17.     DoCmd.GoToRecord , , acPrevious
    18.     List106.Visible = True
    19.     'Opens report
    20.     DoCmd.OpenReport "qryreport", acViewPreview


    PLEEEEEEEEEEASE Help, It's been driving me mad for a week or longer now!
    Last edited by Bazzlad; Oct 28th, 2003 at 08:25 AM.
    *And you'll see, Everything you stand for is fake*
    http://www.rhesusrock.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
  •  



Click Here to Expand Forum to Full Width