Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009

    Unanswered: Access support for checkbox against linked table

    I have an Access file that is using a linked Oracle table.
    When I open the linked table in Access, I want to have a column display as a checkbox like the YES/NO Access datatype does.
    Does anyone know how I can accomplish this?
    "Premature optimization is the root of all evil."

  2. #2
    Join Date
    Jan 2009

    Smile Solution

    Hopefully, this will be useful to someone in the future:

    You can modify the linked table's TableDef. Add a DisplayControl property to your field with property value as 106 for a check box.

    You can execute the code through the Immediate window.
    (If you are not not familiar with the Immediate window. Open it with Ctrl+g. Enter a line of code press Enter, and so on for each line.)

    Since Oracle has no SQL boolean type the field in Oracle should be something like a number(1,0) or varchar2(2)
    *Note* Access saves "No" or unchecked as 0 and "Yes" or checked as -1.

    set db = currentdb
    set fld = db.TableDefs("dbo_foo").Fields("a_number")
    fld.Properties.Append fld.CreateProperty("DisplayControl", dbInteger, 106)
    "dbo_foo" being the linked table and "a_number" the field you want to checkboxify.

    If for some reason your target field already has a DisplayControl value set already, just change the last line to only set the value:
    fld.Properties("DisplayControl") = 106
    ' verify property created with correct value ...
    After setting the property, my a_number field is displayed as a check box when "dbo_foo" is opened in Datasheet View.

    Additionally, you can set other properties the same way instead of "DisplayControl" you could use:
    and so on...
    "Premature optimization is the root of all evil."

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts