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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Checkbox

Status
Not open for further replies.

homless

Technical User
Oct 26, 2009
10
US
Thank you in advance for your help. I am clueless here.

I have an Access form with two check boxes for Instock and OutOfStock products. There is a drop down list for the products. I want to be able to print products that I have selected the checkbox for. If the checkbox is not selected, then the product should not show on the report. The problem is, when I select the product in the checkbox, i have to close the form then open it again so it can show up on the products report and vice versa. What I would like is to print the report without closing the form and have the selected products still show up on the product report.
This is one table called product. The checkboxes are called InStock and outOfStock. Can someone help me figure out as I am clueless how I can make the selection update without having to exit the form.

Thanks
homeless
 
If I understand correctly, you should be able to get by with one field to store either true for In Stock or false for Out of Stock.

I expect you are changing a value and not saving the record prior to opening a report. You can add some code prior to the report opening like:
Code:
  Me.Dirty = False

Duane
Hook'D on Access
MS Access MVP
 
Thank you very much dhookom [thumbsup2]. I put the code below in the After Update for the check boxes and it appears to do what I was looking for. I can select or dis-select a product and the report shows the changes without me closing the form.

If Me.Dirty = True Then
Me.Dirty = False
End If

homless
 
Please tell me what I should do? I created another check box on my product table for discontinued items. But it is not doing what I want it to do. What I would like it to do is to be able save selected discontinued products on the table by putting an X on the corresponding field. I don’t want to see these products again in my list once I have marked them as discontinued. What is happening is that when I mark the check box on the form and I look in the table to see if an X has been saved in the discontinued field, I find that the record has duplicated more than once and there is no X marked anywhere. That is, it has created the same record twice and more depending on how many times I mark the check box without saving. Please let me know if I am not making sense. I appreciate your help again.
 
This makes no sense to me. I have no idea what your table structure is or what the X does. I generally leave the discontinued items in the same table and just filter them out as necessary.

Duane
Hook'D on Access
MS Access MVP
 
I am sorry, I only have one table, product and I have 3 check boxes, InStock, outOfStock and discontinuedItems. I have a query to filter discontinued items but my problem is that Access is putting duplicate rows into the columns when I check on a discontinued item.
Example of product Items:
red shawl
black shawl
green slippers
When I select green slippers as discontinued item and I go to the table to check if the check mark has been put in the field, I find another row has been created for green slippers. So now there are two rows for green sleepers but one is discontinued. However, they both still show up in the drop down. Any ideas?

Thanks.
 

I would change the table structure by eliminating the check boxes.
Instead, use a 'Status' field to show InStock, OutOfStock, or Discontinued.

Randy
 
Actually, I figured out the problem. There was some bad data in the table and after I deleted the bad data, I was not getting the problem with Access duplicating columns anymore. And for the discontinued products check box, i just added the code in the After Update Event:
me.dirty = false
So far, all appears to be working fine.
I am so novice at this so I really appreciate all your help.

Liz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top