VBA Access替换了带图像的复选框

时间:2015-04-09 01:56:15

标签: ms-access access-vba

我想在复选框上创建一些记录替换为图像。但在这种情况下,所有记录都会被替换。有人帮帮我吗?我有以下代码:

strSQL = "SELECT tbl_export_def.nutTar AS isExport, 
tbl_export_def.fieldName, tbl_export_def.fieldAlias, 
tbl_export_def.Description, tbl_export_def.Unitmeasurement, 
tbl_export_def.SortID, tbl_export_def.isKey, tbl_export_def.key, 
tbl_export_def.table FROM tbl_export_def ORDER BY tbl_export_def.SortID ;"

Form_frm_exportRaw_fields.ExportData.ControlSource = "nutTar"
CurrentDb.QueryDefs("Q_isExport").SQL = strSQL  ' change string Query
Form_frm_exportRaw_fields.ExportData.ControlSource = "isExport"
If DLookup("isKey", "Q_isExport", "isKey = True and table = 'tbl_scenarios'") 
Then
    Form_frm_exportRaw_fields.Image_Key.Visible = True
Else
    Form_frm_exportRaw_fields.Image_Key.Visible = False
End If
Form_frm_exportRaw_fields.RecordSource = "SELECT * FROM Q_isExport where 
(Q_isExport.isExport=true)"

1 个答案:

答案 0 :(得分:0)

尝试:

Dim isKey As Boolean
' ...  
isKey = DLookup("isKey", "Q_isExport", "table = 'tbl_scenarios'")
Form_frm_exportRaw_fields.Image_Key.Visible = isKey
' ...