Help with procedure code error

G

Guest

Hi,

I am trying to filter or limit the contents of one combo/list box based on
the selection from another combo/list box. Both are on the same form and use
different rowsource types and row sources.

I have been trying to use the following procedure, but continue to get the
following error:

Runtime error:
Object doesn't support this property or method

Here is the code:

Me![Service procedure].RowSource = "SELECT Code,Description, [Staff Level
1], " & _
"[Staff Level 2], [Staff Level 3], [Staff Level 4], [Staff Level 5] "
& _
"FROM [Service Procs] " & _
"WHERE ([Staff Level 1]=" & Me![Service By Drop Down].Column(2) & ") OR
" & _
"([Staff Level 2]=" & Me![Service By Drop Down].Column(2) & ") OR " & _
"([Staff Level 3]=" & Me![Service By Drop Down].Column(2) & ") OR " & _
"([Staff Level 4]=" & Me![Service By Drop Down].Column(2) & ") OR " & _
"([Staff Level 5]=" & Me![Service By Drop Down].Column(2) & ") " & _
"ORDER BY Code"

I tried the following suggestion to remedy the error, but it has not worked.

If code breaks on this statement again then, in immediate window (<Ctrl> +
<G>), run the statements

?Me![Service procedure].Name
?Me![Service By Drop Down].Column(2)

Any additional help or suggestions would be greatly appreciated.
 
G

George Nicholson

In your code, create a string variable (like "strSQL") and assign your
proposed SQL to that, then assign strSQL to your Rowsource
strSQL = "SELECT Code, Description....."
Me![Service procedure].RowSource = strSQL
Put a breakpoint on the Rowsource assignment. When the code stops on that
line type "? strSQL" in the Immediate window. Look and see what Access is
using as an SQL statement, you may spot the problem, or at least narrow it
down.
 

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

Top