Open another form if data in currently is unavailable

haj1503

Registered User.
Local time
Today, 01:17
Joined
Jul 1, 2003
Messages
50
Hi friend,

I've facing problem with my function

Dim db As Database
Dim rs As Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_CustomerResv", dbOpenDynaset)

If ResvDate = " " Then
MsgBox "No reservation has been enter for this date, Did you want to create new Reservation List?", vbYes
DoCmd.OpenForm "frmReservation"
Else
DoCmd.OpenForm "frmReservationList"
End If

The satuation is I would like to open my frmReservationList but if ResvDate at frmReservationList unavailable then the frmReservation will open.

Anybody can help me to solve this problem?

Thanks in advance.
 
The situation is clear, but your code seems to have only a vague relationship to it. The code needs to run, but it can only be run off a form. You need to open the frmReservationList form first and place code similar to what you've listed in the Open event to check to see if any data is being returned, else open the other form.

It's unclear from your code if the frmReservationList form will have an assigned recordsource or if you are going to be assigning it through code. Either way, you need to specify some criteria. You probably want the frmReservationList form to open only if there's no ResvDate for a specific date.
 

Users who are viewing this thread

Back
Top Bottom