Report does not always have Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

1 ) I have a table that gets data loaded into it from another program (Data
is there)

2) I have a form which displays this data as well as some extra fields
which can be populated by the user. The form also has a "Print label" check
Box, the form also has a command button on it for printing.

3) I have a query which is based on the "Print Label" check box being checked.

4) I have a report which includes all the fields on the form and is based
on the "Print Label" check box.

Now the problem is, some times the report has data in it and sometimes it
dosen't. The data is always in the tables and the "Print Label" check box is
always checked. Below is the code for the Print button. After printing I set
the check box to "No"
Any help is appreciated.

Private Sub Command68_Click()
On Error GoTo Err_Command68_Click
DoCmd.OpenReport "Shiptolabel", acViewPreview
PrintLabel.Value = No
Exit_Command68_Click:
Exit Sub

Err_Command68_Click:
MsgBox Err.Description
Resume Exit_Command68_Click
 
Alan said:
1 ) I have a table that gets data loaded into it from another program (Data
is there)

2) I have a form which displays this data as well as some extra fields
which can be populated by the user. The form also has a "Print label" check
Box, the form also has a command button on it for printing.

3) I have a query which is based on the "Print Label" check box being checked.

4) I have a report which includes all the fields on the form and is based
on the "Print Label" check box.

Now the problem is, some times the report has data in it and sometimes it
dosen't. The data is always in the tables and the "Print Label" check box is
always checked. Below is the code for the Print button. After printing I set
the check box to "No"
Any help is appreciated.

Private Sub Command68_Click()
On Error GoTo Err_Command68_Click
DoCmd.OpenReport "Shiptolabel", acViewPreview
PrintLabel.Value = No


Unless you have declared a global constant of variable named
No, that line doesn't do what you might think. Check boxes
generally only have a value of True (-1) or False (0)
What happens if you set it to False instead of No?

It's also possible that you are setting the check box before
the report has been able to look at it. What happens if you
remove that line?
 
Marshall Barton said:
Unless you have declared a global constant of variable named
No, that line doesn't do what you might think. Check boxes
generally only have a value of True (-1) or False (0)
What happens if you set it to False instead of No?

It's also possible that you are setting the check box before
the report has been able to look at it. What happens if you
remove that line?

Thank you for your reply. Also thank you for clueing me in on the "No" Vs
"False" thing that is good to know. I agreed with you that maybe I was
clearing that before the report had a chance to complete. So I took that
whole line out, and still sometimes I get data in my report and sometimes I
don't. I can not figure it out.
Any other ideas?
Thanks!
 
Alan said:
Thank you for your reply. Also thank you for clueing me in on the "No" Vs
"False" thing that is good to know. I agreed with you that maybe I was
clearing that before the report had a chance to complete. So I took that
whole line out, and still sometimes I get data in my report and sometimes I
don't.


First this to do to debug this kind of problem is to put the
report aside until you can get the report's record source
query to retrieve the desired data.

Try running the query directly from the query design window
and see if you can deduce what is filtering out the records
you want.

If you can't spot the problem, post back with a Copy/Paste
of the query's SQL statement, a short list of some sample
records that you expect to see with a few that are and are
not returned and an explanation of why you think the missing
records should be returned.
 
Back
Top