vendredi 15 janvier 2016

Change Display Control property of a yes/no field to be a check box using VBA

I have a table that is imported from an external access database via VBA that has a check box in a Yes/No type field. This check box allows users to perform complex actions on items selected in the table by clicking a button. The issue I am running into is that when the table gets imported the Yes/No field becomes a text field instead of a check box. Is there any way to change the field back to being a check box instead of a text field?

Code used to import table:

Dim SQL as String
Dim DBS as Database

Set DBS as CurrentDB

SQL = "SELECT [Cost Down Table].* INTO [Cost Down TableX9] FROM [Cost Down Table] IN """"[MS Access;DATABASE=" & FilePath & "]"
DBS.Execute SQL

Code attempting to change field to text box:

Me.CurrentItemsSubFrm.Controls("Select").Properties("DisplayControl") = acCheckBox

This gives me RTE 2455 "You entered an expression that has an invalid reference to the property "DisplayControl".




Aucun commentaire:

Enregistrer un commentaire