View Full Version : using form to get info for report


deekras
02-07-2001, 04:09 PM
i am using a form to get begin and end dates for a report.
if the user does not enter a date, i want the program to tell the to enter a date. then if the end date is less than the begin date, i want it to tell the user.
if the dates are ok, i want to preview the report.

TGHockett
02-07-2001, 08:53 PM
Probably a first good step is to use the MS help screen to get information on "validating data" (it helped me a great deal for my macros).

Then check back in here with more speicific questions if that doesnt help.

HTH

TGH

deekras
02-09-2001, 11:56 AM
i got the coding for making sure that the dates are good and that works. But if there are no errors, (the dates are good), i need to preview the report. I can't figure out how to write that.

Fornatian
02-09-2001, 11:04 PM
Put this behind the OnClick event of the openreport button:

If IsNull(Me![MyBeginDateNameField]) OR
IsNull(Me![MyEndDateNameField]) then
Msgbox "One or more parameters missing",0,"Missing Parameters"
Me![MyBeginDateNameField].SetFocus
ElseIf Me![MyBeginDateNameField]>Me![MyEndDateNameField] Then
Msgbox "The End Date CANNOT be before the start date",0,"Date Invalid"
Me![MyBeginDateNameField].SetFocus
Else
'put the open report code here
End If

Ian



[This message has been edited by Fornatian (edited 02-10-2001).]