Sandra Smith
asked on
Checkbox added, but can't get acCheckBox DisplayControl to work
I got the YesNo column added to my table, but when I tried to use the below:
Private Sub cmdGetData_Click()
Dim strGetData As String
Dim strAddColumn As String
Dim strAlterColumn As String
strGetData = "SELECT tblArchiveMaster.* INTO tblReviewTemp " & _
"FROM tblArchiveMaster " & _
"WHERE tblArchiveMaster.Report = [FORMS]![frmReviews].[cboR eport] " & _
"AND tblArchiveMaster.ImportDat e = [FORMS]![frmReviews].[cboI mportDate] " & _
"AND tblArchiveMaster.UserID = [FORMS]![frmReviews].[cboU serId] " & _
"AND tblArchiveMaster.Completio nDate = [FORMS]![frmReviews].[cboC ompletionD ate] "
strAddColumn = "ALTER TABLE tblReviewTemp ADD COLUMN Select YESNO "
strAlterColumn = "ALTER TABLE tblReviewTemp ALTER COLUMN RowID INTEGER "
DoCmd.DeleteObject acTable, "tblReviewTemp"
DoCmd.RunSQL strGetData
DoCmd.RunSQL strAddColumn
DoCmd.RunSQL strAlterColumn
CurrentDb.TableDefs("tblRe viewTemp") .Fields("S elect").Di splayContr ol = acCheckBox
Me.Refresh
MsgBox "Process completed", vbOKOnly
End Sub
I got the error message of "Compile Error", Method or Data Member Not Found and it highlited the DisplayControl words.
I tried to find the acCheckBox formatting in the Help library, but came up with nothing. Any suggestions?
Sandra
Private Sub cmdGetData_Click()
Dim strGetData As String
Dim strAddColumn As String
Dim strAlterColumn As String
strGetData = "SELECT tblArchiveMaster.* INTO tblReviewTemp " & _
"FROM tblArchiveMaster " & _
"WHERE tblArchiveMaster.Report = [FORMS]![frmReviews].[cboR
"AND tblArchiveMaster.ImportDat
"AND tblArchiveMaster.UserID = [FORMS]![frmReviews].[cboU
"AND tblArchiveMaster.Completio
strAddColumn = "ALTER TABLE tblReviewTemp ADD COLUMN Select YESNO "
strAlterColumn = "ALTER TABLE tblReviewTemp ALTER COLUMN RowID INTEGER "
DoCmd.DeleteObject acTable, "tblReviewTemp"
DoCmd.RunSQL strGetData
DoCmd.RunSQL strAddColumn
DoCmd.RunSQL strAlterColumn
CurrentDb.TableDefs("tblRe
Me.Refresh
MsgBox "Process completed", vbOKOnly
End Sub
I got the error message of "Compile Error", Method or Data Member Not Found and it highlited the DisplayControl words.
I tried to find the acCheckBox formatting in the Help library, but came up with nothing. Any suggestions?
Sandra
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Tyr:
CurrentDb.TableDefs("tblRe viewTemp") .Fields("S elect").Pr operties(" DisplayCon trol")=acC heckBox
If that doesn't work, this should:
With CurrentDb.TableDefs("tblRe viewTemp") .Fields("S elect").Pr operties
.Append .CreateProperty("DisplayCo ntrol",dbL ong,acChec kBox)
End With
CurrentDb.TableDefs("tblRe
If that doesn't work, this should:
With CurrentDb.TableDefs("tblRe
.Append .CreateProperty("DisplayCo
End With
ASKER
I didn't event realize the issue about using "Select"! Got the idea though. Thank you both.
ASKER