Forms and Queries (1 Viewer)

Eureka99

New member
Local time
Today, 12:55
Joined
Jun 29, 2020
Messages
26
I'm not sure if this is best in the Forms, queries or VBA sections.

Also i might be doing this completely wrong, please let me know.

I have a form that is showing some stats about factory production levels. when the factory finish building a product they will log the test within the database as a pass or fail.

I have created some queries to show a few different levels of detail:

*Jobs built by day
*Tests passed / failed by day
*2nd checks passed / failed by day.

I then have a form with an unlinked text box serving as a date selector field.

when the form loads i have a few VBA Dcount and DSum calcs that are run off of the queries.

My problem then comes when I try to update the date and choose to look at another date. I cannot get the queries to re-run as they are stuck using the date provided when the form opens.

Is there a way to create some sort of "refresh" button that would then force the queries to re-calc using the updated date from the form?

The only other way I can think of is to have more tables as "temp" tables and then run delete / append queries to update the data.
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:55
Joined
Jan 23, 2006
Messages
15,379
Can you post a picture of your form?
Show where you "try to update the date".
Show the query code/sql.
How does the "new date" get associated with the query(s)?
You may have to reQuery the form after the new date is entered????
 

Eureka99

New member
Local time
Today, 12:55
Joined
Jun 29, 2020
Messages
26
Ok some files attached:

Can you post a picture of your form? - Stats Form.png
Show where you "try to update the date". - Date textbox.png
Show the query code/sql. - Stats Calcs.png
How does the "new date" get associated with the query(s)? - Date association.png
 

Attachments

  • Date association.PNG
    Date association.PNG
    10.7 KB · Views: 66
  • Date textbox.PNG
    Date textbox.PNG
    31.5 KB · Views: 64
  • Stats calcs.PNG
    Stats calcs.PNG
    50.5 KB · Views: 69
  • Stats form.PNG
    Stats form.PNG
    26 KB · Views: 66

CJ_London

Super Moderator
Staff member
Local time
Today, 12:55
Joined
Feb 19, 2013
Messages
16,613
have you tried using

me.requery

on your button click event? Or perhaps your date control after update event?
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:55
Joined
Jan 23, 2006
Messages
15,379
Is there any code associated with the Refresh at top right of Stats?
As CJ says, you need a Me.ReQuery somewhere to be invoked after you select a new date.
 

Eureka99

New member
Local time
Today, 12:55
Joined
Jun 29, 2020
Messages
26
Just the me.Requery its sole job is just to try and refresh.
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:55
Joined
Jan 23, 2006
Messages
15,379
Can you post the database, or a cut down version with the form? zip it.
Can you post the sql for the queries?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 12:55
Joined
Feb 19, 2013
Messages
16,613
and the full code you are trying to use
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:55
Joined
Sep 21, 2011
Messages
14,305
Simplest way is to run your Form_Load event again?

However it is recommended to put that into it's own Sub and call that from the Load event and your refresh button.
 

Users who are viewing this thread

Top Bottom