?
Solved

Checkbox added, but can't get acCheckBox DisplayControl to work

Posted on 2005-03-29
4
Medium Priority
?
1,113 Views
Last Modified: 2008-03-03
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].[cboReport] " & _
             "AND tblArchiveMaster.ImportDate = [FORMS]![frmReviews].[cboImportDate] " & _
             "AND tblArchiveMaster.UserID = [FORMS]![frmReviews].[cboUserId] " & _
             "AND tblArchiveMaster.CompletionDate = [FORMS]![frmReviews].[cboCompletionDate] "

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("tblReviewTemp").Fields("Select").DisplayControl = 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
0
Comment
Question by:ssmith94015
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:ssmith94015
ID: 13655410
This is a desktop, Access 2003 database
0
 
LVL 4

Accepted Solution

by:
ajsaasta earned 2000 total points
ID: 13656791
"Select" is a reserved word (like in "ALTER TABLE tblReviewTemp ADD COLUMN Select YESNO") and you should either avoid using column names like that or use proper notation:

* "ALTER TABLE tblReviewTemp ADD COLUMN [Select] YESNO"
* CurrentDb.TableDefs("tblReviewTemp").Fields("[Select]").DisplayControl = acCheckBox

I've NOT tested (but encountered this same problem several times) this comment so I cannot quarantee 101% exact proper notation on my example but I hope you get the idea.

Cheers,

ajsaasta
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13657673
Tyr:
CurrentDb.TableDefs("tblReviewTemp").Fields("Select").Properties("DisplayControl")=acCheckBox

If that doesn't work, this should:
With CurrentDb.TableDefs("tblReviewTemp").Fields("Select").Properties
   .Append .CreateProperty("DisplayControl",dbLong,acCheckBox)
End With
0
 

Author Comment

by:ssmith94015
ID: 13674232
I didn't event realize the issue about using "Select"! Got the idea though. Thank you both.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question