Link to home
Start Free TrialLog in
Avatar of rhadash
rhadash

asked on

Access database form has only header- any ideas why it disappeared?

Hi,
Been using this database for some time but today the Report form has only a header.  It is a simple report where user enters start and end date and then clicks on event button to export to excel.  All the code/details are present in design view but are not showing up on the entry form.  I've checked the obvious stuff - stumped.  Appreciate any ideas.
Thanks.
Avatar of rhadash
rhadash

ASKER

Avatar of mbizup
You have the following as criteria on a field in the form's recordsource:

>=[Forms]![frmWhatDates]![StartDate] And <DateAdd("d",1,[Forms]![frmWhatDates]![EndDate])

Since your form't name is frmWhatDates, you have a circular reference and the form does not open properly.

If you remove that criteria, your form will display the detail section.

I imagine that criteria was meant to be placed elsewhere.
Actually, that form does not need a recordsource at all.

It should be unbound.  All you need for the Excel Export is the code behind the button and qryReport (which should not be included as the recordsource of your form)
Summing-Calculated-Field-Issue.accdb
Avatar of rhadash

ASKER

Hi,
I removed the criteria setting from the query.  the start and end date range has returned to the report form but when i set the date ranges the end date does not work - report gives me everthing from start date up to current date not the range requested.  How can this be set?

I don't mean to be disrepectful but the db you attached has only one table and it is not clear to me what I should be getting from it.
Thks.
I mistakenly uploaded a database that was related to another question.

Per my second comment, all you need to do is remove the recordsource from the form.  Leave the criteria intact.
MailProcessing-2012.accdb
Avatar of rhadash

ASKER

I reinstated the criteria.  I removed the record source from the report and now I have a run time error 3258- The sql stmt cound not be executed because it contains ambiguous outer joins.  To force one of the joins to be performed first create a separte query that performs the first join and then include that query in your sql statement.


When i hit debug it takes me to the command4-click() first line is highlighted.
Private Sub Command4_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryReport", "I:\Production\MailProcessing_2012\Summary Reports\MailSummaryReport"
DoCmd.OutputTo acOutputQuery, "qryReport", acFormatXLS, "MailProcessing.xls", True
DoCmd.Close acForm, "frmwhatdates"
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rhadash

ASKER

thank you it does work.  i need to add another column to query looks like that is what caused problem to begin with. Thanks again.