473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Combo histerisis

Hi

My combos seem to have an acquired memory syndrome.

On a query facility, the after update of combo1 fills the rowsource of
combo2 using a sql string, like so:

Public Sub Combo1_AfterUpdate()

Dim nameField as String
Dim sql as String

nameField = Me.Controls("Combo1")
sql = "SELECT " & nameField & " FROM ContactsTbl;"

Me.Controls("Combo2").RowSourceType = "Table/Query"
Me.Controls("Combo2").RowSource = sql

End Sub

The problem is that when this process is done repeatedly, the second
combo wont accept updates that are not a compatible data type as the
previous run.

ie, if on the first run, nameField held a Number data type and on the
second run nameField holds a text data type, then I get an access
error.

I can't find any way to flush all histerisis of the previous data that
was ploncked into Combo2, nor can I find a reason for this behaviour.
As this process is used repeatedly, it is a critical flaw in the app
(a simplified Query Designer).

Regards

Andrew Wrigley

#IF

Giving Users access to the Access Query Designer is like giving a cage
full of monkeys a box full of machine guns.

#THEN

Teaching Users to use the Access Query Designer is like showing the
said monkeys what happens when they pull the triggers of the said
machine guns.

#END
Nov 12 '05 #1
2 1552
Based on the sql statement you are using to populate the rowsource of
combo2 I would assume you are referencing field names in a table called
Contacts. Here is syntax that may help you.

Combo2.RowSourceType = "Table/Query"
Combo2.RowSource = "Select [" & combo1 & "] From Contacts"
Me. Requery

What I did was to add brackets to your argument (combo1). Note: if
combo2 will always be of type Table/Query, you can set that in the
combo2 property sheet in the form design view. Then you can eliminate
that line of code in your routine.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is strange. What version of Access do you have?

I once had a ListBox that I constantly changed the RowSource & the
number of columns displayed. I found that I had to change the Column
Count before changing the RowSource for it to work correctly.

Perhaps you don't need to do as many things as your are doing. E.g.:

Public Sub Combo1_AfterUpdate()

Dim sql as String

If Not IsNull(Me!Combo1) Then
sql = "SELECT " & Me!Combo1 & " FROM ContactsTbl"
Me!Combo2.RowSource = sql
End If

End Sub

If you know the data type you may wish to do this:

sql = "SELECT CLng(" & Me!Combo1 & ") FROM ContactsTbl"

If the result set will return a Long in the column. You can use
whatever conversion function that is required.

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQEZdaoechKqOuFEgEQJT4wCeNZsFW0FKFABEy6aJWBldjg unMMQAn3C1
DKYio2JJA+c5t+zRhphI+zPt
=I8IC
-----END PGP SIGNATURE-----
Andrew Wrigley wrote:
Hi

On a query facility, the after update of combo1 fills the rowsource of
combo2 using a sql string, like so:

Public Sub Combo1_AfterUpdate()

Dim nameField as String
Dim sql as String

nameField = Me.Controls("Combo1")
sql = "SELECT " & nameField & " FROM ContactsTbl;"

Me.Controls("Combo2").RowSourceType = "Table/Query"
Me.Controls("Combo2").RowSource = sql

End Sub

The problem is that when this process is done repeatedly, the second
combo wont accept updates that are not a compatible data type as the
previous run.

ie, if on the first run, nameField held a Number data type and on the
second run nameField holds a text data type, then I get an access
error.

I can't find any way to flush all histerisis of the previous data that
was ploncked into Combo2, nor can I find a reason for this behaviour.
As this process is used repeatedly, it is a critical flaw in the app
(a simplified Query Designer).


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
4
by: Heather | last post by:
Hi I am desparately looking for advice in relation to storing the results after selecting items from two combo boxes on a Referral form. The first combo box 'ctl Type' displays a full list of...
2
by: Jeff Mason | last post by:
I'm observing some strange behavior when I use a bound combo box in conjunction with the combo's anchor property. I define a form which contains just a textbox and a combo box. The text box is...
3
by: hmiller | last post by:
Hey everyone, I am having a hell of a time trying to set this menu system up. Here's what I'm trying to do. Combo Box One; is populated by names under properties "row source" "Phase 1"...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
2
by: kiranmn75 | last post by:
I want to dynamically populate a combo box through javascript. Data is coming from a array. Sometimes data list may contain items in excess of 2000. Explorer takes more than 5 seconds to...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
2
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.