Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

subform based on query

Status
Not open for further replies.

vttech

Technical User
Jan 28, 2006
297
US
I have a subform (SubLogInOut) that record source is based on a query (qryWorkDatesHours)

the qyery code is
Code:
SELECT * FROM tblLogInOut
WHERE employeeID=forms!frmloginout!txtEmployeeID.Value And (workdate Between forms!frmloginout!txtStartDate.value And forms!frmloginout!txtEndDate.value);

The subform is located in an unbound form (frmLogInOut)


I know the query for the subform works because I have a command button that event on_click has
Code:
me.refresh


But the issue is that when the main form loads the Subform does not contain the records based on the query
for some reason I think it's not getting the values of the three controls when the form first loads. But if I
click on the command button to refresh the main form then the subform contains the correct records.

Any Ideas how to solve this issue??



Newbie in search of knowledge
 
Hi, vttech!

I'd cheat and call the button click code during the main form's load event.



 
Hakala

No Luck I tried that way already :)

Newbie in search of knowledge
 
Does the user have to enter something in the main form when they open it?
 
All the dates and data is entered automatically for the main form as it pertains to the query when it loads..

Newbie in search of knowledge
 
I'm stumped. If the data is on the main form, the subform should work if the button_click is called at the right time... how about calling it at the end of the main form load event?

(And if the user isn't required to enter anything on the main form, why do you have a main form?)
 
is there a way to requery the subform after the main form is fully loaded?

Newbie in search of knowledge
 
Add

Code:
Call NameOfButton_Click

to the main form's On Load event.



 
Me!SubLogInOut.Form.Requery

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top