Advertisement

01.24.2008 at 03:08PM PST, ID: 23109618
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Set ComboBox Limit to List propery on form load
Tags: VBA, MS-ACCESS 2003
I need to set some ComboBox properties based on existing values of a record when the form loads.  This is the code that I am trying to use:
If Me.fEWaste = False Then
Set CBO = Me.strCUST_ADDR
With CBO
    .RowSourceType = "Value List"
    .RowSource = vbNullString
    .ColumnCount = 1
    .ColumnWidths = "2.5 in;"
    .LimitToList = False
End With
Else
Set CBO = Me.strCUST_ADDR
With CBO
    .RowSourceType = "Table/Query"
    .RowSource = "vData_Accounts_Ewaste"
    .ColumnCount = 8
    .ColumnWidths = "0 in;0 in;0 in;0 in;0 in;2.5 in;0 in;0 in;"
    .LimitToList = True
End With
End If

Everything seems to be working fine, except that I get an error when fEWaste = false and I try to set the Limit to List property to false.  Any help would be greatly appreciated.
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: AaronGreene1906
Solution Provided By: AaronGreene1906
Participating Experts: 4
Solution Grade: A
Views: 172
Translate:
Loading Advertisement...
01.24.2008 at 03:19PM PST, ID: 20738602

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.24.2008 at 03:20PM PST, ID: 20738605

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.24.2008 at 03:20PM PST, ID: 20738608

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.24.2008 at 03:22PM PST, ID: 20738618

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.24.2008 at 03:23PM PST, ID: 20738632

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.24.2008 at 03:58PM PST, ID: 20738876

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.24.2008 at 08:53PM PST, ID: 20740194

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.24.2008 at 09:45PM PST, ID: 20740395

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.24.2008 at 11:34PM PST, ID: 20740750

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.25.2008 at 08:05AM PST, ID: 20743601

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.25.2008 at 08:11AM PST, ID: 20743681

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.25.2008 at 09:08AM PST, ID: 20744223

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.28.2008 at 09:24PM PST, ID: 20765611

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
01.24.2008 at 03:19PM PST, ID: 20738602

Rank: Genius

property is missing--v
     If Me.fEWaste.Visible = False Then
 
01.24.2008 at 03:20PM PST, ID: 20738605

Rank: Sage

Tested in new form in Access 2000 OK, can you recreate in simple form and also advise what error is returned.
Cheers, Andrew
 
01.24.2008 at 03:20PM PST, ID: 20738608

Rank: Genius

or something else

If Me.fEWaste.Enabled= False Then
 
01.24.2008 at 03:22PM PST, ID: 20738618

Rank: Genius

I just emulated that with no problem.
1:
2:
3:
4:
5:
6:
7:
Private Sub Command7_Click()
    Me.Combo5.RowSourceType = "Value List"
    Me.Combo5.RowSource = vbNullString
    Me.Combo5.ColumnCount = 1
    Me.Combo5.ColumnWidths = "2.5 in"
    Me.Combo5.LimitToList = False
End Sub
Open in New Window
 
01.24.2008 at 03:23PM PST, ID: 20738632

Rank: Genius

>> Me.strCUST_ADDR

That IS a combo box, right ?

mx
 
01.24.2008 at 03:58PM PST, ID: 20738876

Rank: Genius

The issue is rather an interesting one in my opinion. Unless your underlying data for your form changes, or the order in which your data is viewed changes, then the On_Load event will fire for the same record every time. If that's the case, why bother with an IF statement at all. Now, if you move that to Form_Current, then your code will fire on each new record, including the first.
Setting the LimitToList property shouldn't throw an error. It's something else. Maybe that field does'nt have a value during the On_Load event?
J
 
01.24.2008 at 08:53PM PST, ID: 20740194
The form is unbound.  I am using the OnLoad event to load the values of the selected record to the form.  If fEWaste is true then, the user can select a limited number of addresses.  If fEWaste is false, then the user can enter in any address.  I need the form to be able to make this distinction when it is loaded.
 
01.24.2008 at 09:45PM PST, ID: 20740395

Rank: Genius

Can you post the entire OnLoad code ... so we can see the definition of CBO, etc.

thx

mx

 
01.24.2008 at 11:34PM PST, ID: 20740750

Rank: Sage

Can you please also advise what the error is you are receiving.
Cheers, Andrew
 
01.25.2008 at 08:05AM PST, ID: 20743601
This is the OnLoad Event code and the related procedures and variables.  The error that I'm getting states that the database can't set the LimitToList property to No right now.

Private strAPPT_KEY As String

Private Sub Form_Load()
Dim CBO As ComboBox
strAPPT_KEY = Me.OpenArgs
Call procLOAD_VALUES
If Me.fEWaste = False Then
Set CBO = Me.strCUST_ADDR
With CBO
    .RowSourceType = "Value List"
    .RowSource = vbNullString
    .ColumnCount = 1
    .ColumnWidths = "2.5 in;"
    .LimitToList = False
End With
Else
Set CBO = Me.strCUST_ADDR
With CBO
    .RowSourceType = "Table/Query"
    .RowSource = "vData_Accounts_Ewaste"
    .ColumnCount = 8
    .ColumnWidths = "0 in;0 in;0 in;0 in;0 in;2.5 in;0 in;0 in;"
    .LimitToList = True
End With
End If
End Sub


Private Sub procLOAD_VALUES()
Dim cnt As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim strSQL As String

Set cnt = CurrentProject.Connection

strSQL = "SELECT tblHHW.KEY_NO, tblHHW.fEWaste, tblHHW."
strSQL = strSQL & "lngEVENT_ID, tblHHW.datAPPT_DATE, tblHHW."
strSQL = strSQL & "datAPPT_TIME, tblHHW.intAPPT_NUMBER, tblHHW."
strSQL = strSQL & "strENTEREDBY, tblHHW.strACCOUNT, tblHHW."
strSQL = strSQL & "strCUST_FIRST, tblHHW.strCUST_LAST, tblHHW."
strSQL = strSQL & "strCUST_AC, tblHHW.strCUST_TEL, tblHHW."
strSQL = strSQL & "strCUST_ADDR, tblHHW.fITEM_PAINT, tblHHW."
strSQL = strSQL & "fITEM_BATTERY, tblHHW.fITEM_ANTIFREEZE, tblHHW."
strSQL = strSQL & "fITEM_OIL, tblHHW.fITEM_PESTICIDE, tblHHW."
strSQL = strSQL & "strITEM_OTHER, tblHHW.fSHOP, tblHHW.intDESKTOP, "
strSQL = strSQL & "tblHHW.intLAPTOP, tblHHW.intMONITOR, tblHHW."
strSQL = strSQL & "intMONITOR_CRT, tblHHW.intSCANNER, tblHHW."
strSQL = strSQL & "intINKJET, tblHHW.intLASERPRINTER, tblHHW."
strSQL = strSQL & "intTELEVISION, tblHHW.intOTHER_ELEC, tblHHW."
strSQL = strSQL & "fACCESSORIES, tblHHW.fVERIFIED, tblHHW."
strSQL = strSQL & "strVERIFIEDBY, tblHHW.fSIGNED FROM tblHHW WHERE ("
strSQL = strSQL & "((tblHHW.KEY_NO)=" & "'" & strAPPT_KEY & "'" & "));"

rst.Open strSQL, cnt, adOpenKeyset, adLockOptimistic

Me.fEWaste = rst.Fields("fEWaste")
Me.lngEVENT_ID.Value = rst.Fields("lngEVENT_ID").Value
Me.datAPPT_DATE.Value = rst.Fields("datAPPT_DATE").Value
Me.datAPPT_TIME.Value = rst.Fields("datAPPT_TIME").Value
Me.intAPPT_NUMBER.Value = rst.Fields("intAPPT_NUMBER").Value
Me.strENTEREDBY.Value = rst.Fields("strENTEREDBY").Value
Me.strACCOUNT.Value = rst.Fields("strACCOUNT").Value
Me.strCUST_FIRST.Value = rst.Fields("strCUST_FIRST").Value
Me.strCUST_LAST.Value = rst.Fields("strCUST_LAST").Value
Me.strCUST_AC.Value = rst.Fields("strCUST_AC").Value
Me.strCUST_TEL.Value = rst.Fields("strCUST_TEL").Value
Me.strCUST_ADDR.Value = rst.Fields("strCUST_ADDR").Value
Me.fITEM_PAINT.Value = rst.Fields("fITEM_PAINT").Value
Me.fITEM_BATTERY.Value = rst.Fields("fITEM_BATTERY").Value
Me.fITEM_ANTIFREEZE.Value = rst.Fields("fITEM_ANTIFREEZE").Value
Me.fITEM_OIL.Value = rst.Fields("fITEM_OIL").Value
Me.fITEM_PESTICIDE.Value = rst.Fields("fITEM_PESTICIDE").Value
Me.strITEM_OTHER.Value = rst.Fields("strITEM_OTHER").Value
Me.fSHOP = rst.Fields("fSHOP")
Me.intDESKTOP.Value = rst.Fields("intDESKTOP").Value
Me.intLAPTOP.Value = rst.Fields("intLAPTOP").Value
Me.intMONITOR.Value = rst.Fields("intMONITOR").Value
Me.intMONITOR_CRT.Value = rst.Fields("intMONITOR_CRT").Value
Me.intSCANNER.Value = rst.Fields("intSCANNER").Value
Me.intINKJET.Value = rst.Fields("intINKJET").Value
Me.intLASERPRINTER.Value = rst.Fields("intLASERPRINTER").Value
Me.intTELEVISION.Value = rst.Fields("intTELEVISION").Value
Me.intOTHER_ELEC.Value = rst.Fields("intOTHER_ELEC").Value
Me.fACCESSORIES = rst.Fields("fACCESSORIES")

rst.Close
cnt.Close
Set cnt = Nothing

End Sub
 
01.25.2008 at 08:11AM PST, ID: 20743681

Rank: Sage

OK we know that you can set the limit to list property to no even if the values list has no records, therefore, it must be a conflict of the LoadEvent and the way you are loading the controls.

Try commenting out the Call procLOAD_VALUES

We need to try and isolate what is causing the problem.

Cheers, Andrew
 
01.25.2008 at 09:08AM PST, ID: 20744223

Rank: Genius

Just for fun, try this mod:

Private Sub Form_Load()
'  **** Dim CBO As ComboBox
strAPPT_KEY = Me.OpenArgs
Call procLOAD_VALUES
If Me.fEWaste = False Then
' ****** Set CBO = Me.strCUST_ADDR
With Me.strCUST_ADDR
    .RowSourceType = "Value List"
    .RowSource = vbNullString
    .ColumnCount = 1
    .ColumnWidths = "2.5 in;"
    .LimitToList = False
End With
Else
' *****   Set CBO = Me.strCUST_ADDR
With Me.strCUST_ADDR
    .RowSourceType = "Table/Query"
    .RowSource = "vData_Accounts_Ewaste"
    .ColumnCount = 8
    .ColumnWidths = "0 in;0 in;0 in;0 in;0 in;2.5 in;0 in;0 in;"
    .LimitToList = True
End With
End If
End Sub
 
01.28.2008 at 09:24PM PST, ID: 20765611
Sorry that it has taken me a while to get back on this.  I set the bound column property before the Limit To List property, and everything worked fine.
Accepted Solution
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628