Combo is null

W

Walter

I have 3 unbound combos on a form. Combo2's rowsource uses combo1's value as
criteria. Combo1's AfterUpdate Event requeries combo2. Upon making a
selection in combo1, there are no choices in combo2. Also after update of
combo1, if Combo1 = "this value" then do this. In testing with a code break
there, combo1 is null even though "this value" is selected.
Combo1 Rowsource:
SELECT DISTINCT MyTable.Field1
FROM MyTable
WHERE (((MyTable.Field3)=False));

Combo2 Rowsource:
SELECT DISTINCT MyTable.Field2 FROM MyTable WHERE
(((MyTable.Field1)=[me].[MyCombo1]) AND ((MyTable.Field3)=False));

Column count:1
Bound Column:1
RowSource Type:table/query
LimitToList:Yes
ColumnWidth:1"
 
J

Jeff Boyce

Walter

Is that SQL statement "in" your form, or is it the query's SQL?

By the way, what data type is MyTable.Field1? Based on your second SQL, it
would have to be a number data type, since you didn't use any delimiters
around the [me].[MyCombo1] ...

I probably would have used Forms!MyForm!MyCombo1 to specify the value in
MyCombo1 ...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
W

Walter

The sql is copied from the combo's property sheet. The data type is text. I
suspected this was the issue however I've been unable to get the delimiters
right. What is the benefit to using the forms!MyForm!MyCombo! ?
--
Thanks for your help!
Walter


Jeff Boyce said:
Walter

Is that SQL statement "in" your form, or is it the query's SQL?

By the way, what data type is MyTable.Field1? Based on your second SQL, it
would have to be a number data type, since you didn't use any delimiters
around the [me].[MyCombo1] ...

I probably would have used Forms!MyForm!MyCombo1 to specify the value in
MyCombo1 ...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP

Walter said:
I have 3 unbound combos on a form. Combo2's rowsource uses combo1's value
as
criteria. Combo1's AfterUpdate Event requeries combo2. Upon making a
selection in combo1, there are no choices in combo2. Also after update of
combo1, if Combo1 = "this value" then do this. In testing with a code
break
there, combo1 is null even though "this value" is selected.
Combo1 Rowsource:
SELECT DISTINCT MyTable.Field1
FROM MyTable
WHERE (((MyTable.Field3)=False));

Combo2 Rowsource:
SELECT DISTINCT MyTable.Field2 FROM MyTable WHERE
(((MyTable.Field1)=[me].[MyCombo1]) AND ((MyTable.Field3)=False));

Column count:1
Bound Column:1
RowSource Type:table/query
LimitToList:Yes
ColumnWidth:1"
 
W

Walter

The Forms!MyForm!MyCombo reference corrected the situation without any
delimiters.
--
Thanks for your help!
Walter


Jeff Boyce said:
Walter

Is that SQL statement "in" your form, or is it the query's SQL?

By the way, what data type is MyTable.Field1? Based on your second SQL, it
would have to be a number data type, since you didn't use any delimiters
around the [me].[MyCombo1] ...

I probably would have used Forms!MyForm!MyCombo1 to specify the value in
MyCombo1 ...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP

Walter said:
I have 3 unbound combos on a form. Combo2's rowsource uses combo1's value
as
criteria. Combo1's AfterUpdate Event requeries combo2. Upon making a
selection in combo1, there are no choices in combo2. Also after update of
combo1, if Combo1 = "this value" then do this. In testing with a code
break
there, combo1 is null even though "this value" is selected.
Combo1 Rowsource:
SELECT DISTINCT MyTable.Field1
FROM MyTable
WHERE (((MyTable.Field3)=False));

Combo2 Rowsource:
SELECT DISTINCT MyTable.Field2 FROM MyTable WHERE
(((MyTable.Field1)=[me].[MyCombo1]) AND ((MyTable.Field3)=False));

Column count:1
Bound Column:1
RowSource Type:table/query
LimitToList:Yes
ColumnWidth:1"
 
J

Jeff Boyce

Text is delimited with quotes.

"Me." refers to the active form (or report).

"Forms!MyForm!MyCombo" explicitly points at a specific control on a form.

Regards

Jeff Boyce
Microsoft Office/Access MVP


Walter said:
The sql is copied from the combo's property sheet. The data type is text.
I
suspected this was the issue however I've been unable to get the
delimiters
right. What is the benefit to using the forms!MyForm!MyCombo! ?
--
Thanks for your help!
Walter


Jeff Boyce said:
Walter

Is that SQL statement "in" your form, or is it the query's SQL?

By the way, what data type is MyTable.Field1? Based on your second SQL,
it
would have to be a number data type, since you didn't use any delimiters
around the [me].[MyCombo1] ...

I probably would have used Forms!MyForm!MyCombo1 to specify the value in
MyCombo1 ...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP

Walter said:
I have 3 unbound combos on a form. Combo2's rowsource uses combo1's
value
as
criteria. Combo1's AfterUpdate Event requeries combo2. Upon making a
selection in combo1, there are no choices in combo2. Also after update
of
combo1, if Combo1 = "this value" then do this. In testing with a code
break
there, combo1 is null even though "this value" is selected.
Combo1 Rowsource:
SELECT DISTINCT MyTable.Field1
FROM MyTable
WHERE (((MyTable.Field3)=False));

Combo2 Rowsource:
SELECT DISTINCT MyTable.Field2 FROM MyTable WHERE
(((MyTable.Field1)=[me].[MyCombo1]) AND ((MyTable.Field3)=False));

Column count:1
Bound Column:1
RowSource Type:table/query
LimitToList:Yes
ColumnWidth:1"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Reduce combo box selections 2
Cascading ComboBox 1
Combo box trouble 1
Combobox property problem 6
List box not displaying data 8
Combo2 error 5
combo box data type 1
combo box from a query 3

Top