Filtering a Data Access Page w/ Drop Down Lists

P

Pat

I am trying to get this to work...I want to filter data based on two
drop down lists. I reviewed the MSDN article regarding this and
implemented everything according to the steps. The page still is not
working and it isn't even returning anything in the drop down lists.
The two fields I want to use as filters are Project Manager and TAF
Recommendation # both these fields are from related tables to the main
table of data that I want to see. I think the problem is that I am
inserting this into the script editor in the wrong place but I am not
very familiar with script so I don't know where it needs to go...Please
help!!!

Here is the code I used:
<SCRIPT language=vbscript event=DataPageComplete(dscei) for=MSODSC>
<!--

' fInited is used to make sure this code runs only the first time the
' page loads.
If (fInited = FALSE And dscei.DataPage.GroupLevel.RecordSource = _
"tblMilestones")
Then
fInited = TRUE
' Make the list boxes initially empty.
cboProj_Manager.value = ""
cboRecommendation_Num.value = ""
' Use Undo as a workaround to hide the initial band that displays
' when the page loads.

MSODSC.Datapages(0).Undo
End If
-->
</SCRIPT>

<SCRIPT language=vbscript event=OnChange for=cboProj_Manager>
<!--
OnFilterComboChange()
-->
</SCRIPT>

<SCRIPT language=vbscript>
Dim fInited
fInited=FALSE
Sub OnFilterComboChange()
Dim stWhere

' Don't do anything unless user selects a value from each list box.
If (cboProj_Manager.value <> "" And cboRecommendation_Num.value <> "")
Then
stWhere = "Proj_Manager=" & cboProj_Manager.value & " "
stWhere = stWhere & "AND Recommendation_Num='"
&cboRecommendation_Num.value& "' "
' Set the server filter on the tblMilestones recordset.
MSODSC.RecordsetDefs.Item("tblMilestones").ServerFilter = stWhere
End If
End Sub
</SCRIPT>
 

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