Report filter from form, form update/refresh

Dunnopat

Registered User.
Local time
Today, 12:52
Joined
Mar 21, 2010
Messages
16
Hello

Two questions:

1. I have a form with a table on bottom. On the table, each row has a checkbox. Using it will save it to table the form is based on. There is also a report button.

I want the report show only the data that have checkbox = true in the form. It is easy to make it show those rows that are checked true in the original table but that's not what I want.


2. I have a form with a table. Unfortunately, it cannot be updated. There is a checkbox that needs to be used. I made it so that when one clicks a checkbox in the table, it opens a small popup form that allows the user to change it to true/false.

The problem is that after the popup form is closed, the changed data/checkbox isn't refreshed on the original table. Pressing F5 helps. How do I automate this press of F5 when the popup form is closed? I tried many macros but I just can't make it happen.
 
Hello

Two questions:

1. I have a form with a table on bottom. On the table, each row has a checkbox. Using it will save it to table the form is based on. There is also a report button.

I want the report show only the data that have checkbox = true in the form. It is easy to make it show those rows that are checked true in the original table but that's not what I want.


...........

You will need to make a query to collect all the data you wish to show on your report, in the criteria for your query under the check box use the following;
Code:
Forms!YourFormName!CheckBoxName = -1
A checked check box will return a value of -1 (Unchecked = 0) you can also use True if you wish.


Hello
.........

2. I have a form with a table. Unfortunately, it cannot be updated. There is a checkbox that needs to be used. I made it so that when one clicks a checkbox in the table, it opens a small popup form that allows the user to change it to true/false.

The problem is that after the popup form is closed, the changed data/checkbox isn't refreshed on the original table. Pressing F5 helps. How do I automate this press of F5 when the popup form is closed? I tried many macros but I just can't make it happen.

In the On Close event of your pop up form put the following line of code;
Code:
Forms!YourFormName.Requery
 
Last edited:
Thanks!! You saved my a bunch of time and headache.
 
Hello.

Forms!YourFormName.Requery worked well. I wonder why macro didn't work.

However, unfortunately, I have no idea what you mean by:

"You will need to make a query to collect all the data you wish to show on your report, in the criteria for your query under the check box use the following;
Forms!YourFormName!CheckBoxName = -1"

I have a report that is based on a complex query A. I have a form that is based on a query B. They have some fields in common, such as ID and the checkboxes.

The form, when you open it, only shows the data where checkboxes are false, so they can be set to true. Then, using report button, it creates a report that shows some data, rows of data, those rows that were checked true. The rows in the report contain more data but both have IDs.

I only managed to make it show the data that matched the selected row in the form if it was checked true.


I tried something. Whenever the form is opened, a random number is generated. Then, it checks if the number is saved on some rows. If it is, it generates a new number until it is not found.

In the form, when you check rows, it sets value of a hidden field into that generated number (TempVar) and the report could choose data based on those (numbers are saved into the table). When the form is closed, the tempvar is deleted.

This method opened new possibilities. Unfortunately, I couldn't get it to work. I still think that the simple way would be the better.

 
If you already have a query populating your report, you simply need to make sure your check box is part of that query and put the following in the criteria filed under the Check Box;
Code:
Forms!YourFormName!CheckBoxName = -1
 

Users who are viewing this thread

Back
Top Bottom