Eddie Mason
Registered User.
- Local time
- Today, 04:54
- Joined
- Jan 31, 2003
- Messages
- 142
Little more help:
I was given the following function which works perfectly: -
Public Function FieldLine(FName As String, TName As String, Separator As String) As String
Dim Mydb As Database
Dim Rst As Recordset
Set Mydb = CurrentDb
Set Rst = Mydb.OpenRecordset("SELECT " & FName & " FROM " & TName & " WHERE " & FName & " Is Not Null")
FieldLine = ""
While Not Rst.EOF
FieldLine = FieldLine & Rst.Fields(0) & Separator
Rst.MoveNext
Wend
If FieldLine <> "" Then
FieldLine = Left(FieldLine, Len(FieldLine) - Len(Separator)) 'to remove last separator
End If
End Function
What I’m trying to do is use query as a filter to control the fieldline. When I manually enter the criteria to the query the function works perfectly, however when I use a form to create the queries criteria the function returns an error.
If I run the filter query whilst the form is open it produces the correct list of options so it must be seeing the form.
Can anyone help with this.
Kind regards
Eddie
I was given the following function which works perfectly: -
Public Function FieldLine(FName As String, TName As String, Separator As String) As String
Dim Mydb As Database
Dim Rst As Recordset
Set Mydb = CurrentDb
Set Rst = Mydb.OpenRecordset("SELECT " & FName & " FROM " & TName & " WHERE " & FName & " Is Not Null")
FieldLine = ""
While Not Rst.EOF
FieldLine = FieldLine & Rst.Fields(0) & Separator
Rst.MoveNext
Wend
If FieldLine <> "" Then
FieldLine = Left(FieldLine, Len(FieldLine) - Len(Separator)) 'to remove last separator
End If
End Function
What I’m trying to do is use query as a filter to control the fieldline. When I manually enter the criteria to the query the function works perfectly, however when I use a form to create the queries criteria the function returns an error.
If I run the filter query whilst the form is open it produces the correct list of options so it must be seeing the form.
Can anyone help with this.
Kind regards
Eddie