Trying to get a form to requery data specified prior to opening (1 Viewer)

HealthyB1

Registered User.
Local time
Today, 11:26
Joined
Jul 21, 2013
Messages
82
Hi There ,
I am a newbie to this forum.
I have a main form "FrmTimesheetEdit" that I open in edit mode to review data in a query that uses two tables TblEmployee and TblTimeSheet. The TblEmployee has two fields called EmployeeID, and Employee. The Tbltimesheet table has a field "Weekendingdate" and "EmployeeID"
Prior to loading the mainform I launch a form "frmEmployeeReportRange" that allows me to specify via combo box the Employee I am interested in and also the time periods I am interested in being "Beginningdate" and "EndingDate" These in turn are criteria for my query that supplies data to the main form "FrmTimesheetEdit" Everything seems to work ok.
However the first time I open the main form It open a form/window saying "Enter parameter Value" for EmployeeId, BeginningDate and Ending date respectively. Then the subform loads "frmEmployeeReportRange" which allows me to specify Employee plus beginning and ending dates.
I select Employee from the combo box say "Emp1" and specify Beginning and Ending dates of 1-Jun-2013 and 30-Jun-2013. I then make the form invisible and the mainform opens up.
I do this but get no records. If I close the main form "FrmTimesheetEdit" and reopen it the subform pops up as expected. It is preloaded with the data I entered the first time i.e. Emp1 plus 1-Jun-2013 and 30-Jun-13
If I leave the dates the same but select the next employee "Emp2" and them make the form invisible the mainform opens in edit mode as expected but with the records and dates specified for Emp1.
Bottom line it would appear that although the filter data is specified for the query that feeds the main form it is not requerying prior to opening the form.
I have tried having the "frmEmployeeReportRange" launched as a VBA event on each of 'On Open' , 'On Load' and 'On Current' but no matter where I put it the results are the same in that the mainform is not requerying the data prior to opening. What am I doing wrong?.
 

GinaWhipp

AWF VIP
Local time
Yesterday, 21:56
Joined
Jun 21, 2011
Messages
5,881
HealthyB1...

Trying clearing the Filter and Order By on on Unload of the Form...

Me.Filter = ""
Me.OrderBy = ""

It might be that since it's not being *released* it can't *reset* when opened.
 

GinaWhipp

AWF VIP
Local time
Yesterday, 21:56
Joined
Jun 21, 2011
Messages
5,881
@Cronk...

New Users cannot post databases. If memory serves me correctly they need 10 posts to do so.
 

HealthyB1

Registered User.
Local time
Today, 11:26
Joined
Jul 21, 2013
Messages
82
THanks Gina,

I solved the problem and will close this.

Cheers
 

Users who are viewing this thread

Top Bottom