If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
TableDefs question
I have been experimenting with Allen Browne's system for using an Integer
field in place of a Yes/No field: http://allenbrowne.com/NoYesNo.html The article contains the following code as a way of getting a table to use a check box as a display control for an Integer field: CurrentDb.TableDefs("Table1").Fields("Field1").Pro perties("DisplayControl") = CInt(acCheckBox) Allen makes a sample database available. It contains only a table with two fields: one for Yes/No and the other for Yes/No/Null. The Yes/No field shows the display control on the lookup tab as 106, which is for check box, as I understand. I can copy that field into a table in my database, rename it, and all is well. However, if I try in my own database to select 106 as the display control it does not work, of course. Since there are no other objects in the sample database file I couldn't see where the code is used. I finally figured out that I can copy the code above into a sub in a standard module (substituting an actual table and field name) and run the code. The named field will have 106 as the display control, and will display in datasheet view as a checkbox. I can then copy and paste that field, just as I can copy and paste the field from Allen sample table. However, I cannot enter 106 as the display property for other number fields in my database. It seems likely that Allen used a table from an existing database in which he used the TableDefs code, and stripped out everything except one table with two fields. Somehow the changed field has acquired properties that persist even in another database. The custom field is completely portable. What's going on? How did the field transformed by code acquire properties unavailable to other fields? Other than "106" as the display control I cannot find a property or anything else to explain that the field is different from other number fields. |
#2
|
|||
|
|||
TableDefs question
AFAIK, Bruce, you can only set the property programmatically.
I don't think there is a way to set it through the interface. Copying the field and pasting it into another table is the simplest way to get it into your database. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "BruceM" wrote in message ... I have been experimenting with Allen Browne's system for using an Integer field in place of a Yes/No field: http://allenbrowne.com/NoYesNo.html The article contains the following code as a way of getting a table to use a check box as a display control for an Integer field: CurrentDb.TableDefs("Table1").Fields("Field1").Pro perties("DisplayControl") = CInt(acCheckBox) Allen makes a sample database available. It contains only a table with two fields: one for Yes/No and the other for Yes/No/Null. The Yes/No field shows the display control on the lookup tab as 106, which is for check box, as I understand. I can copy that field into a table in my database, rename it, and all is well. However, if I try in my own database to select 106 as the display control it does not work, of course. Since there are no other objects in the sample database file I couldn't see where the code is used. I finally figured out that I can copy the code above into a sub in a standard module (substituting an actual table and field name) and run the code. The named field will have 106 as the display control, and will display in datasheet view as a checkbox. I can then copy and paste that field, just as I can copy and paste the field from Allen sample table. However, I cannot enter 106 as the display property for other number fields in my database. It seems likely that Allen used a table from an existing database in which he used the TableDefs code, and stripped out everything except one table with two fields. Somehow the changed field has acquired properties that persist even in another database. The custom field is completely portable. What's going on? How did the field transformed by code acquire properties unavailable to other fields? Other than "106" as the display control I cannot find a property or anything else to explain that the field is different from other number fields. |
#3
|
|||
|
|||
TableDefs question
Thanks for the reply. What you have explained is about what I had figured
since there didn't seem to be any other options for seeing properties, but maybe I had missed something. It was just that I prefer to understand as much as I can about what is going on. Once I could get the same results on my own I was OK with it, and will certainly use the copy and paste option in the future. I guess when there is an unusual option such as 106 the assumption is that the change was made programatically. "Allen Browne" wrote in message ... AFAIK, Bruce, you can only set the property programmatically. I don't think there is a way to set it through the interface. Copying the field and pasting it into another table is the simplest way to get it into your database. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "BruceM" wrote in message ... I have been experimenting with Allen Browne's system for using an Integer field in place of a Yes/No field: http://allenbrowne.com/NoYesNo.html The article contains the following code as a way of getting a table to use a check box as a display control for an Integer field: CurrentDb.TableDefs("Table1").Fields("Field1").Pro perties("DisplayControl") = CInt(acCheckBox) Allen makes a sample database available. It contains only a table with two fields: one for Yes/No and the other for Yes/No/Null. The Yes/No field shows the display control on the lookup tab as 106, which is for check box, as I understand. I can copy that field into a table in my database, rename it, and all is well. However, if I try in my own database to select 106 as the display control it does not work, of course. Since there are no other objects in the sample database file I couldn't see where the code is used. I finally figured out that I can copy the code above into a sub in a standard module (substituting an actual table and field name) and run the code. The named field will have 106 as the display control, and will display in datasheet view as a checkbox. I can then copy and paste that field, just as I can copy and paste the field from Allen sample table. However, I cannot enter 106 as the display property for other number fields in my database. It seems likely that Allen used a table from an existing database in which he used the TableDefs code, and stripped out everything except one table with two fields. Somehow the changed field has acquired properties that persist even in another database. The custom field is completely portable. What's going on? How did the field transformed by code acquire properties unavailable to other fields? Other than "106" as the display control I cannot find a property or anything else to explain that the field is different from other number fields. |
Thread Tools | |
Display Modes | |
|
|