filter problem

pb21

Registered User.
Local time
Today, 14:14
Joined
Nov 2, 2004
Messages
122
I have the following code that works in other forms but not this one:

Private Sub Form_Open(Cancel As Integer)
' Declare and set a variable to store the WHERE
' clause that describes the records you want to
' display.
Dim strCond As String
strCond = "STUDENT-DSN = Forms!FrmEnhancedEnrolment!StudentID"

' Use the IsLoaded function
' to check whether the Enrolment
' form is open, then set the properties.
If IsLoaded("FrmEnhancedEnrolment") Then
Forms![FrmBookCourseEnhanced].FilterOn = True
Forms![FrmBookCourseEnhanced].Filter = strCond
End If
End Sub

Is in because the name has a hyphen in it? if so is there anything I can do about this so that I can synchronise the form?

regards in advance :(
 
1. If you are going to use characters like hyphen or underscore place the field name in square brackets and if in doubt do it anyway. I.e.
Code:
strCond = "[STUDENT-DSN] = Forms!FrmEnhancedEnrolment!StudentID"
You can understand how - can easily be mistaken for an operator.

2. Make sure AllowFilters is true.

3. I'm going to watch the Rugby so bye... :)

Hope this helps.
 

Users who are viewing this thread

Back
Top Bottom