Setting Filter with Form

S

S Jackson

I have a form [frmMaster] that contains a control to open up a dialog form
in which the user can select the sort order for a field contained in a
report. I want the report to open up displaying the information for the
record selected in the first frmMaster.
Here it is:

If Forms!fdlgSortIndex!optSort = 1 Then
Me.GroupLevel(0).SortOrder = False
Else
Me.GroupLevel(0).SortOrder = True
End If

'Close the sort order dialog form
Dim strForm As String
strForm = "fdlgSortIndex"
DoCmd.Close acForm, strForm

'set where condition for report
'([CaseId]= 284)

Me.Filter = Me.CaseId = Forms!frmMaster!CaseId
'Turn on the filter
Me.FilterOn = True

Trouble is, I get a message saying that me.Filter = Me.CaseId =
Forms!frmMaster!CaseId has no value. What is missing in the syntax? Its
making me crazy. Everything else works beautifully except the filter.

Thanks in advance
S. Jackson
 
M

Marshall Barton

S said:
I have a form [frmMaster] that contains a control to open up a dialog form
in which the user can select the sort order for a field contained in a
report. I want the report to open up displaying the information for the
record selected in the first frmMaster.
Here it is:

If Forms!fdlgSortIndex!optSort = 1 Then
Me.GroupLevel(0).SortOrder = False
Else
Me.GroupLevel(0).SortOrder = True
End If

'Close the sort order dialog form
Dim strForm As String
strForm = "fdlgSortIndex"
DoCmd.Close acForm, strForm

'set where condition for report
'([CaseId]= 284)

Me.Filter = Me.CaseId = Forms!frmMaster!CaseId
'Turn on the filter
Me.FilterOn = True

Trouble is, I get a message saying that me.Filter = Me.CaseId =
Forms!frmMaster!CaseId has no value. What is missing in the syntax? Its
making me crazy. Everything else works beautifully except the filter.

The filter property is a string:

Me.Filter = "CaseId = " & Forms!frmMaster!CaseId
 
S

S Jackson

Thanks! It works now.

S. Jackson

Marshall Barton said:
S said:
I have a form [frmMaster] that contains a control to open up a dialog form
in which the user can select the sort order for a field contained in a
report. I want the report to open up displaying the information for the
record selected in the first frmMaster.
Here it is:

If Forms!fdlgSortIndex!optSort = 1 Then
Me.GroupLevel(0).SortOrder = False
Else
Me.GroupLevel(0).SortOrder = True
End If

'Close the sort order dialog form
Dim strForm As String
strForm = "fdlgSortIndex"
DoCmd.Close acForm, strForm

'set where condition for report
'([CaseId]= 284)

Me.Filter = Me.CaseId = Forms!frmMaster!CaseId
'Turn on the filter
Me.FilterOn = True

Trouble is, I get a message saying that me.Filter = Me.CaseId =
Forms!frmMaster!CaseId has no value. What is missing in the syntax? Its
making me crazy. Everything else works beautifully except the filter.

The filter property is a string:

Me.Filter = "CaseId = " & Forms!frmMaster!CaseId
 

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