Connecting Tech Pros Worldwide Forums | Help | Site Map

Cannot update checkboxes with an update query in access 97 - help!!

Newbie
 
Join Date: Mar 2007
Posts: 2
#1: Mar 23 '07
Hi,

I'm trying to use an update query to update a checkbox field in access 97.

In the update query design I am indicating in criteria:
[fieldname]=true

When I run the update query, a message box appears saying "You are about to update xxx records. .... Are you sure you want to update these?" to which I click yes.

However, when I check the table, none of the checkboxes have been updated - they are all still empty.

Can someone help me out with this - is there some issue I should be aware of when trying to update checkboxes?

Many thanks.

ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,223
#2: Mar 23 '07

re: Cannot update checkboxes with an update query in access 97 - help!!


Quote:

Originally Posted by rch2

Hi,

I'm trying to use an update query to update a checkbox field in access 97.

In the update query design I am indicating in criteria:
[fieldname]=true

When I run the update query, a message box appears saying "You are about to update xxx records. .... Are you sure you want to update these?" to which I click yes.

However, when I check the table, none of the checkboxes have been updated - they are all still empty.

Can someone help me out with this - is there some issue I should be aware of when trying to update checkboxes?

Many thanks.

Your Criteria states that [fieldname]=True which would return all values which are Checked (Yes) but you state that the Check Boxes are still empty. I'm lost.
Newbie
 
Join Date: Mar 2007
Posts: 2
#3: Mar 23 '07

re: Cannot update checkboxes with an update query in access 97 - help!!


Quote:

Originally Posted by ADezii

Your Criteria states that [fieldname]=True which would return all values which are Checked (Yes) but you state that the Check Boxes are still empty. I'm lost.

Sorry, I meant to say that I have typed in the 'Update to:' section, not the 'criteria' section. So:

All checkboxes are currently empty (ie: FALSE).

I want to update them all to checked (ie: TRUE).

In the update query design I have the following:
Update to: [fieldname]=TRUE
Criteria:FALSE

When I run this, it tells me it is updating all records, but when I go to the table none of the boxes are checked.

hope that makes sense !!
Newbie
 
Join Date: Mar 2007
Posts: 13
#4: Mar 23 '07

re: Cannot update checkboxes with an update query in access 97 - help!!


Hi

I think you need to select the field you want to update twice (side by side, so to speak). In the first instance you show the criteria for the update, and in the second you show the update to.

B
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#5: Mar 25 '07

re: Cannot update checkboxes with an update query in access 97 - help!!


Quote:

Originally Posted by rch2

Sorry, I meant to say that I have typed in the 'Update to:' section, not the 'criteria' section. So:

All checkboxes are currently empty (ie: FALSE).

I want to update them all to checked (ie: TRUE).

In the update query design I have the following:
Update to: [fieldname]=TRUE
Criteria:FALSE

When I run this, it tells me it is updating all records, but when I go to the table none of the boxes are checked.

hope that makes sense !!

Do me a favour because I think your syntax is wrong here. Change the query view to SQL and copy and paste it in here.

Mary
missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 3,002
#6: Mar 25 '07

re: Cannot update checkboxes with an update query in access 97 - help!!


This drove me crazy, because I couldn't get it to work either! Finally figured it out. Checkboxes can have one of three separate formats; Yes/No, True/False and On/Off! The trick is that in the Query Grid, your Update To and Criteria have to match the format you've set in your table!

If in your table definition your field is defined as True/False then in your query:

Criteria False
Update to True

but if your field in the table design view is defined as Yes/No (which is the default) then you have to use

Criteria No
Update to Yes

So you need to go into the Design View for you table and see what format your checkbox field has and match it up in the query!
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,223
#7: Mar 25 '07

re: Cannot update checkboxes with an update query in access 97 - help!!


Quote:

Originally Posted by missinglinq

This drove me crazy, because I couldn't get it to work either! Finally figured it out. Checkboxes can have one of three separate formats; Yes/No, True/False and On/Off! The trick is that in the Query Grid, your Update To and Criteria have to match the format you've set in your table!

If in your table definition your field is defined as True/False then in your query:

Criteria False
Update to True

but if your field in the table design view is defined as Yes/No (which is the default) then you have to use

Criteria No
Update to Yes

So you need to go into the Design View for you table and see what format your checkbox field has and match it up in the query!

That is a great point to know - Thanks.
missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 3,002
#8: Mar 25 '07

re: Cannot update checkboxes with an update query in access 97 - help!!


One of the reasons I love Access, despite all its many quirks, and cruising this forum, is that there's always something new to learn about it!
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#9: Mar 25 '07

re: Cannot update checkboxes with an update query in access 97 - help!!


Quote:

Originally Posted by missinglinq

This drove me crazy, because I couldn't get it to work either! Finally figured it out. Checkboxes can have one of three separate formats; Yes/No, True/False and On/Off! The trick is that in the Query Grid, your Update To and Criteria have to match the format you've set in your table!

If in your table definition your field is defined as True/False then in your query:

Criteria False
Update to True

but if your field in the table design view is defined as Yes/No (which is the default) then you have to use

Criteria No
Update to Yes

So you need to go into the Design View for you table and see what format your checkbox field has and match it up in the query!

Just one addition to this. If you put -1 for True or Yes and 0 for False or No it will work.
Reply