Subform not showing all the data (1 Viewer)

ili_sophia

Registered User.
Local time
Today, 21:57
Joined
Aug 23, 2017
Messages
40
Hi there,
I have a form where the users can select and search for the date in the table and it will appear in the subform. I have set the start date selection to be the min date in the table and the end date to be the max date in the table.

However, I am facing the problem of the subform not showing all the data when I first open the form. Means that the data does not cover all the data of the start to end date range, it only shows part of it.
but when i search for all the available date, it does show the data in the subform.
How can i solve this problem of the subform not showing all the data?

Thank you
 

isladogs

MVP / VIP
Local time
Today, 13:57
Joined
Jan 14, 2017
Messages
18,186
Change the record source for your subform so it isn't filtered at startup.
When you select the start/end dates, update the record source so it is filtered accordingly
 

ili_sophia

Registered User.
Local time
Today, 21:57
Joined
Aug 23, 2017
Messages
40
i managed to change the record source from those subforms where data that is from the table and it worked.
But i have some forms where the subform is a query how do I change the record source of those?
 

isladogs

MVP / VIP
Local time
Today, 13:57
Joined
Jan 14, 2017
Messages
18,186
Either change the query or if you don't want to do that, create a new record source in design view.
To do that, click the ellipsis button (...) to the right of the record source on the form property sheet. It will open what is effectively a query designer window except that you will be saving it as SQL rather than a query.
 

ili_sophia

Registered User.
Local time
Today, 21:57
Joined
Aug 23, 2017
Messages
40
I'm not quite sure about what you mean. I have attached my example, could you help me take a look at it? thanks !
 

Attachments

  • test.zip
    412.6 KB · Views: 34

isladogs

MVP / VIP
Local time
Today, 13:57
Joined
Jan 14, 2017
Messages
18,186
OK - change of plan once I'd seen what you have.

You had hard coded the dates on the subform

I've changed the Dyeing Date range criteria on the subform to :
Code:
 Between [Forms]![Dyeing Summary].[DyeingStartDate] And [Forms]![Dyeing Summary].[DyeingEndDate]/CODE]

This means it will always match the 2 dates on the main form

I've added this line to the AfterUpdate event of both date fields on the main form:
[CODE]    Me.subDyeing.Requery

This will cause the subform to update automatically after you change either date (& click Enter)
 

Attachments

  • test-CR.zip
    100.3 KB · Views: 32

Users who are viewing this thread

Top Bottom