G
Guest
Hello,
I'm trying to expand on a filter that I previously created. My filter is
created from a combo box where the user would select a fieldname and then a
corresponding value combo box would show those items - that works great if
all the fields are from the same table
ie this works great
Me.cboVal1.Rowsource = "Select distinct [" _
& Me.cboCrit1 & "]" _
& "From tblevents"
- I'm my case the fields are in different tables.
so I'm trying to dynamically build the after update for the row source by:
Dim strfield1 as string
Dim strfield2 as string
strfield1 = "(select tblfield from sstable where viewname = ' " &
Me.txtCrit1 & " ')"
strfield2 = "(select tbltable from sstable where viewname = ' " &
Me.txtCrit1 & " ')"
Me.txtVal1.RowSource = "select distinct" & strfield1 & " from " & strfield2
tblfield is a list of fields that are to be searched (coloreye)
tbltable is the name of the table to be searched (tblColorEye)
viewname is a friendly name of the field (Eye Color)
txtCrit1 is the name of the combo box that displays the list of the viewname
field
I don't get an error, just no results. I've put single and double quotes
everywhere I could think and didn't get it working.
So my questions are many. Is this a reasonable approach and if so what am I
doing wrong? If not a good approach can you recommend how to do this.
thanks much in advance for your advice... I'm stumped!
I'm trying to expand on a filter that I previously created. My filter is
created from a combo box where the user would select a fieldname and then a
corresponding value combo box would show those items - that works great if
all the fields are from the same table
ie this works great
Me.cboVal1.Rowsource = "Select distinct [" _
& Me.cboCrit1 & "]" _
& "From tblevents"
- I'm my case the fields are in different tables.
so I'm trying to dynamically build the after update for the row source by:
Dim strfield1 as string
Dim strfield2 as string
strfield1 = "(select tblfield from sstable where viewname = ' " &
Me.txtCrit1 & " ')"
strfield2 = "(select tbltable from sstable where viewname = ' " &
Me.txtCrit1 & " ')"
Me.txtVal1.RowSource = "select distinct" & strfield1 & " from " & strfield2
tblfield is a list of fields that are to be searched (coloreye)
tbltable is the name of the table to be searched (tblColorEye)
viewname is a friendly name of the field (Eye Color)
txtCrit1 is the name of the combo box that displays the list of the viewname
field
I don't get an error, just no results. I've put single and double quotes
everywhere I could think and didn't get it working.
So my questions are many. Is this a reasonable approach and if so what am I
doing wrong? If not a good approach can you recommend how to do this.
thanks much in advance for your advice... I'm stumped!