Combo box run time error 438

B

Brian Snelling

Private Sub cbxProjectID_AfterUpdate()

Hi,
I'm trying to filter one combo box in a subform based on another in the
main form using Access97. I got this code from one of the helpful websites
and adapted it. When I make a change in combo box cbxProjectID I get run
time error 438 and debug takes me to the second last line (
Forms![frmDailyRecords]!fsubDailyRecordDetails.cbxBlock.RowSource =
sBlockSource
). Where am I going wrong?

Dim sBlockSource As String
sBlockSource = "SELECT [tblBlocks].[BlockID], [tblBlocks].[ProjectID],
[tblBlocks].[strProjectName] " & _
"FROM tblBlocks " & _
"WHERE [ProjectID] = " & Me.cbxProjectID.Value


Forms![frmDailyRecords]!fsubDailyRecordDetails.cbxBlock.RowSource =
sBlockSource
Forms![frmDailyRecords]!fsubDailyRecordDetails.cbxBlock.Requery



Thanks for any help.
Brian S.
 
B

Brian Snelling

Thank you Joan,
I've replaced my line of code with yours but still get the same
error. Is there more info I can supply?

Brian S.
 
J

Joan Wild

The link I provided should help in getting the syntax correct. It depends
on where you are when you call the code; and where the control is relative
to where you are. Study the chart and post back with the details, and I'll
help you sort it out.
 

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