G
Guest
Hi all.
I got a set of Combos on my Form, and i'm using a single Query as their
RowSource.
When the user clicks on a Combo, the BeforeUpdate Event is used to
'construct' the required SQL string, which is then 'passed' to the above
mentioned Query with DAO (QueryDefs etc.).
This works fine, i.e. the Combos are a bit faster, and display the correct
set/subset of information.
The problem is, sometimes they act funny.
That is, when the user picks a value from the Combo list, this value is
treated as Numeric (instead of Text), which creates an Error (you can't
assign this value to this field etc.).
The Query has the correct SQL string, and the Combo list is also ok, but the
chosen value is (sometimes, not always!) recognized as Numeric (though it's
Text).
Here's the code i use to assign the SQL that's being constructed when the
BeforeUpdate event of a Combo is fired to the Single Query that's used as the
Combos' RowSouce.
This code resides in the Form where the Combos are:
---------------------------------------------------------------
Dim dbs as DAO.Database
Dim qdf as DAO.QueryDef
Dim strQrySel as String
strQrySel = "Qry_ActiveSelection"
Set dbs = CurrentDb()
Set qdf = dbs.QueryDefs(strQrySel)
qdf.SQL = strSQL ' strSQL = the SQL string that's already
constructed
dbs.QueryDefs.Refresh ' Refreshing the QueryDefs Collection
Set qdf = Nothing
Me.Requery
Me.Refresh
-----------------------------------------------------------------
Again, this generates the correct data set for the Combos, the problem is
(sometimes!) the Combos decide that this data is Numeric.
Am i missing something here?
Any suggestion is welcome.
Thanks,
Alex
I got a set of Combos on my Form, and i'm using a single Query as their
RowSource.
When the user clicks on a Combo, the BeforeUpdate Event is used to
'construct' the required SQL string, which is then 'passed' to the above
mentioned Query with DAO (QueryDefs etc.).
This works fine, i.e. the Combos are a bit faster, and display the correct
set/subset of information.
The problem is, sometimes they act funny.
That is, when the user picks a value from the Combo list, this value is
treated as Numeric (instead of Text), which creates an Error (you can't
assign this value to this field etc.).
The Query has the correct SQL string, and the Combo list is also ok, but the
chosen value is (sometimes, not always!) recognized as Numeric (though it's
Text).
Here's the code i use to assign the SQL that's being constructed when the
BeforeUpdate event of a Combo is fired to the Single Query that's used as the
Combos' RowSouce.
This code resides in the Form where the Combos are:
---------------------------------------------------------------
Dim dbs as DAO.Database
Dim qdf as DAO.QueryDef
Dim strQrySel as String
strQrySel = "Qry_ActiveSelection"
Set dbs = CurrentDb()
Set qdf = dbs.QueryDefs(strQrySel)
qdf.SQL = strSQL ' strSQL = the SQL string that's already
constructed
dbs.QueryDefs.Refresh ' Refreshing the QueryDefs Collection
Set qdf = Nothing
Me.Requery
Me.Refresh
-----------------------------------------------------------------
Again, this generates the correct data set for the Combos, the problem is
(sometimes!) the Combos decide that this data is Numeric.
Am i missing something here?
Any suggestion is welcome.
Thanks,
Alex