473,505 Members | 13,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combo Box Error in Row Source

132 New Member
I have a subform with 2 drop down boxes. The choices in the 2nd drop down box depend on the value of the first . When I run the subform on its own, it all works beautifully. However, when the I run the main form that calls the subform, I get a one of those parameter input required messages. As Greg Brady would say, "what gives"? Here is the code (query) from the subform:

SELECT SecondaryDisorder.[Secondary Disorder]
FROM SecondaryDisorder
WHERE (((SecondaryDisorder.[Primary Disorder])=[forms]![case subform]![combo86]));
Jun 4 '07 #1
36 2358
Rabbit
12,516 Recognized Expert Moderator MVP
I have a subform with 2 drop down boxes. The choices in the 2nd drop down box depend on the value of the first . When I run the subform on its own, it all works beautifully. However, when the I run the main form that calls the subform, I get a one of those parameter input required messages. As Greg Brady would say, "what gives"? Here is the code (query) from the subform:

SELECT SecondaryDisorder.[Secondary Disorder]
FROM SecondaryDisorder
WHERE (((SecondaryDisorder.[Primary Disorder])=[forms]![case subform]![combo86]));
The syntax to refer something on a subform is Forms!SubformControl.Form.Control
Jun 4 '07 #2
Proaccesspro
132 New Member
The syntax to refer something on a subform is Forms!SubformControl.Form.Control

I updated the SQL on the subform......same error!!!

SELECT SecondaryDisorder.[Secondary Disorder]
FROM SecondaryDisorder
WHERE (((SecondaryDisorder.[Primary Disorder])=[forms]![SubformControl].[case subform].[combo86]));
Jun 4 '07 #3
Rabbit
12,516 Recognized Expert Moderator MVP
I updated the SQL on the subform......same error!!!

SELECT SecondaryDisorder.[Secondary Disorder]
FROM SecondaryDisorder
WHERE (((SecondaryDisorder.[Primary Disorder])=[forms]![SubformControl].[case subform].[combo86]));
[case subform] is the subform control.
Form stays as is.

I should've been more clear.

[Forms]![case subform].Form.[combo86]
Jun 4 '07 #4
Proaccesspro
132 New Member
[case subform] is the subform control.
Form stays as is.

I should've been more clear.

[Forms]![case subform].Form.[combo86]

I'm still confused......In your example, what goes in place of the word Form? Would it be the the Main form??

In my DB, Main Form is the Main form and Case Subform is the subform.
Jun 4 '07 #5
Rabbit
12,516 Recognized Expert Moderator MVP
I'm still confused......In your example, what goes in place of the word Form? Would it be the the Main form??

In my DB, Main Form is the Main form and Case Subform is the subform.
Nothing would go in Form. Form stays as is.
Jun 4 '07 #6
FishVal
2,653 Recognized Expert Specialist
Hi!

It's very simple.
When you open form as subform, it will not be added to collection 'Forms".
So referencing like "Forms!frmSubForm.Controls!ctrName" will return value when frmName is open as independant form.
If it is open as subform the valid reference will be "Forms!frmMainForm.Controls!frmSubForm.Form!Contro ls!ctrName".
Jun 4 '07 #7
Proaccesspro
132 New Member
Nothing would go in Form. Form stays as is.
Well....Access put brackets around FORM, but it still does not work. Here is the code in the query:

[Forms]![case subform].[Form].[combo86]
Jun 4 '07 #8
Rabbit
12,516 Recognized Expert Moderator MVP
Are you trying to do this from the after update event of the combobox? Because that's where you have to do it from.

You can't just set the control source of the combobox to that SQL statement because it will never update.

And you said the "code (query) from the subform", I assume this is in reference to the row source of the combo box.
Jun 4 '07 #9
Proaccesspro
132 New Member
Hi!

It's very simple.
When you open form as subform, it will not be added to collection 'Forms".
So referencing like "Forms!frmSubForm.Controls!ctrName" will return value when frmName is open as independant form.
If it is open as subform the valid reference will be "Forms!frmMainForm.Controls!frmSubForm.Form!Contro ls!ctrName".
Where would I place this code??
Jun 4 '07 #10
Rabbit
12,516 Recognized Expert Moderator MVP
You would put it in the after update event of the combo box that should trigger a change.

Take a look at this tutorial.
Jun 4 '07 #11
Proaccesspro
132 New Member
Are you trying to do this from the after update event of the combobox? Because that's where you have to do it from.

You can't just set the control source of the combobox to that SQL statement because it will never update.

And you said the "code (query) from the subform", I assume this is in reference to the row source of the combo box.
Yes.... the first box is titled combo86...I have this code in the after update event. The second combo box is titled combo90. what do i need to add?

Me![Combo90] = Null
Me![Combo90].Requery


[Forms]![case subform].Form.[Combo86]

End Sub
Jun 4 '07 #12
Proaccesspro
132 New Member
Yes.... the first box is titled combo86...I have this code in the after update event. The second combo box is titled combo90. what do i need to add?

Me![Combo90] = Null
Me![Combo90].Requery


[Forms]![case subform].Form.[Combo86]

End Sub
Here is the code I created.....It's not quite working...

Private Sub Combo86_AfterUpdate()
With Me![Combo86]
If IsNull(Me!Combo90) Then
.RowSource = ""
Else
.RowSource = "Select[Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]=" & Me!Combo86

End If
Call .Requery
End With


Ed Sub
Jun 4 '07 #13
Proaccesspro
132 New Member
Here is the code I created.....It's not quite working...

Private Sub Combo86_AfterUpdate()
With Me![Combo86]
If IsNull(Me!Combo90) Then
.RowSource = ""
Else
.RowSource = "Select[Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]=" & Me!Combo86

End If
Call .Requery
End With


Ed Sub

Here is my latest code....When run, the second combo box does not have any choices...in other words, i guess it is not finding a match
Jun 4 '07 #14
Rabbit
12,516 Recognized Expert Moderator MVP
You're using the wrong combo boxes. And some of your spacing is wrong. And this assumes that Combo86 and [Primary Disorder] are numbers.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo86_AfterUpdate()
  2. With Me![Combo90]
  3.    If IsNull(Me!Combo86) Then
  4.       .RowSource = ""
  5.    Else
  6.       .RowSource = "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]=" & Me!Combo86
  7.    End If
  8.    Call .Requery
  9. End With
  10. End Sub
Jun 5 '07 #15
Proaccesspro
132 New Member
You're using the wrong combo boxes. And some of your spacing is wrong. And this assumes that Combo86 and [Primary Disorder] are numbers.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo86_AfterUpdate()
  2. With Me![Combo90]
  3.    If IsNull(Me!Combo86) Then
  4.       .RowSource = ""
  5.    Else
  6.       .RowSource = "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]=" & Me!Combo86
  7.    End If
  8.    Call .Requery
  9. End With
  10. End Sub
They are NOT numbers.
Jun 5 '07 #16
Rabbit
12,516 Recognized Expert Moderator MVP
They are NOT numbers.
That's what your original code implied.

You'll need to use single quotes to tell it that it's text.

Expand|Select|Wrap|Line Numbers
  1. "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "'"
Jun 5 '07 #17
Proaccesspro
132 New Member
That's what your original code implied.

You'll need to use single quotes to tell it that it's text.

Expand|Select|Wrap|Line Numbers
  1. "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "'"
Here is what I have:

Private Sub Combo86_AfterUpdate()
With Me![Combo90]
If IsNull(Me!Combo86) Then
.RowSource = ""
Else
.RowSource = "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "'"
End If
Call .Requery
End With
End Sub
Jun 5 '07 #18
Proaccesspro
132 New Member
That's what your original code implied.

You'll need to use single quotes to tell it that it's text.

Expand|Select|Wrap|Line Numbers
  1. "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "'"
Here is what I have. Still no data in Combo90

Private Sub Combo86_AfterUpdate()
With Me![Combo90]
If IsNull(Me!Combo86) Then
.RowSource = ""
Else
.RowSource = "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "'"
End If
Call .Requery
End With
End Sub
Jun 5 '07 #19
Proaccesspro
132 New Member
Here is what I have. Still no data in Combo90

Private Sub Combo86_AfterUpdate()
With Me![Combo90]
If IsNull(Me!Combo86) Then
.RowSource = ""
Else
.RowSource = "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "'"
End If
Call .Requery
End With
End Sub
I copied EXACTLY what you wrote.....still NO cigar!!!

Private Sub Combo86_AfterUpdate()
With Me![Combo90]
If IsNull(Me!Combo86) Then
.RowSource = ""
Else
.RowSource = "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "'"
End If
Call .Requery
End With
End Sub
Jun 5 '07 #20
Rabbit
12,516 Recognized Expert Moderator MVP
What is the row source of combo86?
What is the metadata of your two tables?
Jun 5 '07 #21
Proaccesspro
132 New Member
What is the row source of combo86?
What is the metadata of your two tables?
Combo86 Row Source = table Primary Disorder field Disorder

Metadata of 2 tables = Primary Disorder has 1 field named disorder. it is designated as text

Secondary Disorder has 2 fields named primary disorder and secondary disorder. Both are designated as text
Jun 5 '07 #22
FishVal
2,653 Recognized Expert Specialist
I copied EXACTLY what you wrote.....still NO cigar!!!

Private Sub Combo86_AfterUpdate()
With Me![Combo90]
If IsNull(Me!Combo86) Then
.RowSource = ""
Else
.RowSource = "Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "'"
End If
Call .Requery
End With
End Sub
Hi!

Actually you have a small mistake in your SQL query string. From some reasons Access will appreciate SQL string terminated with ";". So your RowSource property should be set to
Me![Combo90].RowSource="Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "';"


If it is not helpful then trace your sub.

Toggle breakpoint on the row (<F9> key)
Private Sub Combo86_AfterUpdate()
When the debugger will popup do the following:
1) type "? Me!Combo86" in Immediate pane and press enter, see what does it actually return
2) proceed stepwise (<F8> key) to the row
End If
3) type "? .RowSource" in Immediate pane and press return
4) copy the SQL string and paste it in query builder
5) run query and see what it does return

Good Luck
Jun 5 '07 #23
Rabbit
12,516 Recognized Expert Moderator MVP
I'm stretching here, try taking the brackets off of combo90 in the code. I don't think the semicolon is a problem here. You can do without it most of the time.
Jun 5 '07 #24
Rabbit
12,516 Recognized Expert Moderator MVP
You have a subform on this right?
Where are the combo boxes located?
Jun 5 '07 #25
Proaccesspro
132 New Member
Hi!

Actually you have a small mistake in your SQL query string. From some reasons Access will appreciate SQL string terminated with ";". So your RowSource property should be set to
Me![Combo90].RowSource="Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='" & Me!Combo86 & "';"


If it is not helpful then trace your sub.

Toggle breakpoint on the row (<F9> key)
Private Sub Combo86_AfterUpdate()
When the debugger will popup do the following:
1) type "? Me!Combo86" in Immediate pane and press enter, see what does it actually return
2) proceed stepwise (<F8> key) to the row
End If
3) type "? .RowSource" in Immediate pane and press return
4) copy the SQL string and paste it in query builder
5) run query and see what it does return

Good Luck

I think I might have discovered something.....I failed to mention that this is a one to many relationship...the primary disorder will generate multple choices for the secondary disorder.....I ran the de-bugger and it all seems to work OK...when I got to the end if statement, the row source read

Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='Immuno Disorder';

In the secondary disorder table I have this

Primary Disorder Secondary Disorder
Immuno Disorder Chron Fatique Synd
Immuno Disorder Fibromyalgia
Immuno Disorder Lupus
Immuno Disorder Rhematism
Immuno Disorder Rheumatoid Arthritis
Immuno Disorder Scleroderma
Immuno Disorder Other

So the drop down box (combo90) should list the above choices but instead it is blank, as is my idea on what's wrong!!
Jun 5 '07 #26
Proaccesspro
132 New Member
You have a subform on this right?
Where are the combo boxes located?
Yes...there are actually 2 subforms on the main form.....so I have a main form, subform1, and subform2. The combo boxes are on subform 1 (titled case subform)
Jun 5 '07 #27
Proaccesspro
132 New Member
I'm stretching here, try taking the brackets off of combo90 in the code. I don't think the semicolon is a problem here. You can do without it most of the time.
took out the brackets...no difference
Jun 5 '07 #28
FishVal
2,653 Recognized Expert Specialist
I think I might have discovered something.....I failed to mention that this is a one to many relationship...the primary disorder will generate multple choices for the secondary disorder.....I ran the de-bugger and it all seems to work OK...when I got to the end if statement, the row source read

Select [Secondary Disorder] FROM SecondaryDisorder WHERE [Primary Disorder]='Immuno Disorder';

In the secondary disorder table I have this

Primary Disorder Secondary Disorder
Immuno Disorder Chron Fatique Synd
Immuno Disorder Fibromyalgia
Immuno Disorder Lupus
Immuno Disorder Rhematism
Immuno Disorder Rheumatoid Arthritis
Immuno Disorder Scleroderma
Immuno Disorder Other

So the drop down box (combo90) should list the above choices but instead it is blank, as is my idea on what's wrong!!
You may do the following:

1) Check the properties of Combo90:
ColumnCount=1,
ColumnWidth>0 or nothing
BoundColumn=1,
RowSourceType=Table/Query
... maybe something else

2) Manually set RowSource in design view and see whether Combo90 is at all able to reflect query

3) :) or simply add a new combobox and try with it

Good Luck.
Jun 6 '07 #29
Proaccesspro
132 New Member
You may do the following:

1) Check the properties of Combo90:
ColumnCount=1,
ColumnWidth>0 or nothing
BoundColumn=1,
RowSourceType=Table/Query
... maybe something else

2) Manually set RowSource in design view and see whether Combo90 is at all able to reflect query

3) :) or simply add a new combobox and try with it

Good Luck.
The problem was in COMBO90's properties!! THANKS!!!

Other questions for you. Are you able to modify the font size and color of the tabs when using the tab control function?? Also, can you modify the font on a form diplayed in datasheet view?
Jun 6 '07 #30
Rabbit
12,516 Recognized Expert Moderator MVP
The problem was in COMBO90's properties!! THANKS!!!

Other questions for you. Are you able to modify the font size and color of the tabs when using the tab control function?? Also, can you modify the font on a form diplayed in datasheet view?
No to question 1, maybe for question 2. I think whatever your defaults are for tables will affect your datasheet view. So if you change your default fonts for everything else, it may affect the datasheet view.
Jun 6 '07 #31
Proaccesspro
132 New Member
No to question 1, maybe for question 2. I think whatever your defaults are for tables will affect your datasheet view. So if you change your default fonts for everything else, it may affect the datasheet view.
Thanks for all your help, Rabbit!
Jun 6 '07 #32
Rabbit
12,516 Recognized Expert Moderator MVP
Thanks for all your help, Rabbit!
Not a problem, good luck.
Jun 6 '07 #33
FishVal
2,653 Recognized Expert Specialist
The problem was in COMBO90's properties!! THANKS!!!

Other questions for you. Are you able to modify the font size and color of the tabs when using the tab control function?? Also, can you modify the font on a form diplayed in datasheet view?
Glad to help you.

What concerns your questions:

1) Form datasheet view.

There is no opportunity to change Datasheet appearance in design view.
However you can make it programmatically through Form object. Go to object browser and see numerous properties within object Form having names "Datasheet..." which allow you to change the appearance of your datasheet.

2) Tab control.

You can change tab font and tab page backcolor in design view.

Good Luck
Jun 7 '07 #34
Rabbit
12,516 Recognized Expert Moderator MVP
Glad to help you.

What concerns your questions:

1) Form datasheet view.

There is no opportunity to change Datasheet appearance in design view.
However you can make it programmatically through Form object. Go to object browser and see numerous properties within object Form having names "Datasheet..." which allow you to change the appearance of your datasheet.

2) Tab control.

You can change tab font and tab page backcolor in design view.

Good Luck
In regards to #2, whenever I've tried to set those properties they never work and just keep their default values.
Jun 7 '07 #35
jmunoz66
2 New Member
CASCADING SELECTION COMBOS INSIDE OF A SUBFORM

Sorry guys, i followed up this thread, but i loose my way.

I Have the same system and Error you discussed above:

1 Main Form....... CentrosDeEstudio
2 SubForm..........Centros_Det
3 4 Comboboxes (Region,Provincia,Distrito,Municipo) on cacaded selection inside of Centros_Det :
Region delimites
Provincia delimites
Distrito delimites
Municipio (they all together defines a Geo location)
4 Rowsource type for them (comboboxes) is Table/Query
5 The four comboboxes binds to catalogs that have the fields ID (numeric primary key), nombre (used for description string) and a field used to link as child on a one to many relationship to the preceeding catalog .

6 When i Choose Region = 1 from the first combo box (REGION), i expected to receive a list of options corresponding to the linked Provincias on Provincia ComoBox Instead of, i received an empty list, ..... and so.

7 on PROVINCIA Rowsource i built "Select provincia.id,provincia.Nombre From Provincias where provincia.region = Forms!CentrosDeEstudio!Centros_det.Form!Region which syntax it is accepted by the wizard

8 On Region AfterUptate Event, i shooted a trigger that basically does Me.Provincia.Requery intended to update the next combobox selection

I´ve tryed all the sorts of refferences to the combobox objects i've found, but Nothing works eventhough they do when i run Centros_det as an independent Form.

Could you help please??? i´ll appreciate your coments.

PD I Apologize by my English

Thanks
Jun 16 '07 #36
jmunoz66
2 New Member
!!! Proof and Error !!!

I have solved my problem yet, and i hope you do too.

I used:
Forms![MainForm].[Form]![Subform].[Form]![ControlName] ....
from wherever I´m.... and its works,

See You Guys and Girls
Jun 24 '07 #37

Sign in to post your reply or Sign up for a free account.

Similar topics

9
19444
by: Bob Alston | last post by:
I have a drop down combo box that gives the user to enter an item not in the list by adding it to the list. The list is a table. It works fine on Access2003 but fails on Access2002/XP. ON XP, it...
4
1797
by: Larry Tate | last post by:
I am wanting to get those cool html error pages that ms produces when I hit an error in asp.net. For instance, when I get a compilation error I get an html error page that shows me the ...
2
1854
by: MLH | last post by:
I invoked the combo-box wizard today, telling it to use a 4-table union query as a row-source for the combo-box it was assisting me in building. The error I got was without number and stated,...
2
943
by: Eric | last post by:
Hello, I'm a little green in this area, so any suggested reading or examples is appreciated. In my release version of managed code, is there a way to know what command caused an exception? ...
0
1725
by: Stimp | last post by:
I've created an aspx page called HistoryManage.aspx. The page works fine on my local machine but when I load it off the web I get the following strange error... Compilation Error...
21
8507
by: Mark Rae | last post by:
Hi, I have an ASP.NET 2 web application (not web site) project and am using a web deployment project to deploy to the testing, then the production server. All has been working well for months...
3
4732
by: John | last post by:
AC2007 I changed my combo's row source and then the autocomplete stopped working. The combo is two columns, bound to the first. First column is primary key (ID). Second column is a...
0
1205
bajajv
by: bajajv | last post by:
Hi, I am working with C++ builder 2007 and getting this error many times. Source file not found Forms.pas. Any idea what is this and how to solve this?
3
1484
by: Gord | last post by:
Is it possible to somehow add the option of "All" at the top of the list of a combo's drop down list? I'm hoping I don't have to go and re-jig the underlying table and/or query that the list is...
0
942
by: Ajobi Mike | last post by:
Error : Source file or directory missing or cannot be read. I got the above error while installing my SQL 2000 Server from a folder already copied on my desktop. Please how can I solve this...
0
7213
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
7098
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
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.