Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

I can't get a checkbox to work with a yes/no field.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe Dunfee - 01 May 2007 21:14 GMT
I am having some problems with a check box.  I've added a field named "Floor"
, which is a yes/no field. tWhen I create the ehckbox I realize I must bind
it to a control source, which I do to the field named Orders!Floor.  However,
when I click the checkbox on the form, I get the error message

"Control can't be edited. It's bound to the expression Orders!Floor."

I've tried unbinding the checkbox, and then using visual basic "on click"
event for that checkbox to read the value of the field, and then toggle the
display of the checkbox.  But, then I get the error in visual basic, that the
variable "Floor" is not defined.

Note that if I show the box with the list of fields, the "floor" field is
not listed, even though it is a field in the table.  I've tried exiting
Access and restarting to see if that would help Access remember what fields
are available.

What might I be doing wrong?

Joe Dunfee
Joan Wild - 01 May 2007 21:32 GMT
If floor is not listed in the field list, then probably your form isn't based on the table.  More likely a query, or a SQL statement.

Open the form in design view, find the RecordSource property and hit the build button (...) to the right.

Edit the QBE grid to include the floor field.  Now you can set the controlsource of the checkbox to 'floor'

Signature

Joan Wild
Microsoft Access MVP

>I am having some problems with a check box.  I've added a field named "Floor"
> , which is a yes/no field. tWhen I create the ehckbox I realize I must bind
[quoted text clipped - 16 lines]
>
> Joe Dunfee
Joe Dunfee - 02 May 2007 16:59 GMT
Thanks Joan and Sprinks for the replies.

I have not deliberately created any queries, and when I look at the Objects
Window to see if there are any queries and none are listed. When I select the
"..." next to the Control Source property for the check box, I am asked if I
want to create a query.  If I say Yes, then in the query window, I can drag
the Floor field I want to the query.

What puzzles me is that,(before creating any queries, the list of fields
available for me to put on the form includes information from both tables.
[The two tables are called Customers, and Orders]

The wizzard I used to first create the form allowed me to select fields from
two different tables.

After selecting the form using the selection button at the intersection of
the rulers, the Record Source property currently says "SELECT Customer".  The
drop down list shows the two tables, but I can only select one of them.  If I
select the "..." then I am asked if I want to create a Query.

I tried again to create a new form using the wizzard.  I was able to include
fields from both tables.  When I looked at the control source for the Floor
field checkbox, it simply says "floor".  I even tried just copying the
checkbox from this new form onto my original one.. but that doesn't work.

Perhaps, to add a new field from a table, you must create a query?  I would
rather not create a query unless I need to.

Joe Dunfee
Joan Wild - 02 May 2007 18:34 GMT
> I have not deliberately created any queries, and when I look at the Objects
> Window to see if there are any queries and none are listed. When I select the
> "..." next to the Control Source property for the check box, I am asked if I
> want to create a query.  If I say Yes, then in the query window, I can drag
> the Floor field I want to the query.

No, I said to select the "..." next to the Record Source property for the form.  Add the Floor field to the record source.

> After selecting the form using the selection button at the intersection of
> the rulers, the Record Source property currently says "SELECT Customer".  The
> drop down list shows the two tables, but I can only select one of them.  If I
> select the "..." then I am asked if I want to create a Query.

OK, so click Yes and you can add the tables/fields you want.  When done, don't click 'save', as that will save a query.  Instead Close the window and when you are prompted to save the changes, click Yes.  This will leave the record source with a SQL statement (SELECT Customer,....), but the Floor field added.

Once back in design view of the form, in the control source property for the check box, don't click on "...", instead click the dropdown and choose Floor.

Signature

Joan Wild
Microsoft Access MVP

Joe Dunfee - 02 May 2007 19:47 GMT
Thanks for the tip.

I just found another way around these limitations.  I created a new form
using the wizard, and added all fields from both tables.  Then I deleted
everything on the new form, and finally copied everying off of the original
field onto the new one. However, I lost much of my VBA code in the transfer.  
Your method preserves the original form along with its VBA code.

Joe Dunfee
Sprinks - 01 May 2007 21:39 GMT
Joe,

If a table is specified as a form's RecordSource, all fields will show up in
the Field List and the drop down list in the ControlSource property field.  I
suspect your form's RecordSource is actually a query based on your table
rather than the table itself, and that you have not included Floor in the
query.  Add the field to your query, save it, and it should be available to
you.

Hope that helps.
Sprinks

> I am having some problems with a check box.  I've added a field named "Floor"
> , which is a yes/no field. tWhen I create the ehckbox I realize I must bind
[quoted text clipped - 16 lines]
>
> Joe Dunfee
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.