Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Combo is null

Geek News

Combo is null
Walter 12/18/2008 9:56:40 PM
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"

--
Thanks for your help!
Walter
Re: Combo is null
"Jeff Boyce" <nonsense[ at ]nonsense.com> 12/18/2008 10:10:13 PM
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" <Walter[ at ]discussions.microsoft.com> wrote in message
news:2DCC436C-2A1A-437A-9EBF-B6E65C9944D6[ at ]microsoft.com...
[Quoted Text]
>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"
>
> --
> Thanks for your help!
> Walter


Re: Combo is null
Walter 12/18/2008 10:32:02 PM
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" wrote:

[Quoted Text]
> 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" <Walter[ at ]discussions.microsoft.com> wrote in message
> news:2DCC436C-2A1A-437A-9EBF-B6E65C9944D6[ at ]microsoft.com...
> >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"
> >
> > --
> > Thanks for your help!
> > Walter
>
>
>
Re: Combo is null
Walter 12/18/2008 10:41:01 PM
The Forms!MyForm!MyCombo reference corrected the situation without any
delimiters.
--
Thanks for your help!
Walter


"Jeff Boyce" wrote:

[Quoted Text]
> 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" <Walter[ at ]discussions.microsoft.com> wrote in message
> news:2DCC436C-2A1A-437A-9EBF-B6E65C9944D6[ at ]microsoft.com...
> >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"
> >
> > --
> > Thanks for your help!
> > Walter
>
>
>
Re: Combo is null
"Jeff Boyce" <nonsense[ at ]nonsense.com> 12/18/2008 10:42:07 PM
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" <Walter[ at ]discussions.microsoft.com> wrote in message
news:75E1510A-3BC4-4447-A78B-8296462AB1A9[ at ]microsoft.com...
[Quoted Text]
> 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" wrote:
>
>> 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" <Walter[ at ]discussions.microsoft.com> wrote in message
>> news:2DCC436C-2A1A-437A-9EBF-B6E65C9944D6[ at ]microsoft.com...
>> >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"
>> >
>> > --
>> > Thanks for your help!
>> > Walter
>>
>>
>>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net