A
Andrea M
I have posted this code previously, when I was having difficulty binding the
record source to my form and having the data be editable. I received a link
to a helpful MSDN article that I followed and now the data that comes up in
the form can be edited.
Now, the problem is, the code in this same routine that sets the server
filter doesn't seem to be working. Or rather, I'm guessing, that it is some
how undone. I say that because, when I step through the execution of the
code and watch the me.serverfilter property, it appears to set properly.
When the subroutine ends, it is still set. When I step through the last two
lines of code in the routine that calls my set_recordset subroutine and check
in the immediate window about the me.serverfilter property, it is still set.
Yet, when I see the data in the form, it isn't filtered. When I put the form
into design view, the server filter property is blank. If I directly enter a
server filter property into the form in design view and then run the code, it
disappears when the code is done executing.
I'm still trying to figure out ADP's. Any input is appreciated.
Thanks,
Andrea
Here's the code:
Sub Set_RecordSource(strServerFilter As String)
' Makes sure detail is visible and subform properly linked as connects
RecordSource
Dim blnConnectSub As Boolean
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
If Me.Detail.Visible = False Then
Me.Detail.Visible = True
Me.NavigationButtons = True
blnConnectSub = True
End If
Me.ServerFilter = strServerFilter
Set cn = CurrentProject.AccessConnection
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = "Select * from vwCollectionNoPic"
' .ServerFilter = strServerFilter
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseServer
.Open
End With
Set Me.Recordset = rs
Me.ServerFilter = strServerFilter
Set rs = Nothing
Set cn = Nothing
If blnConnectSub Then
Me.sub_frm_artist.LinkChildFields = "artist id"
Me.sub_frm_artist.LinkMasterFields = "artist id"
End If
End Sub
record source to my form and having the data be editable. I received a link
to a helpful MSDN article that I followed and now the data that comes up in
the form can be edited.
Now, the problem is, the code in this same routine that sets the server
filter doesn't seem to be working. Or rather, I'm guessing, that it is some
how undone. I say that because, when I step through the execution of the
code and watch the me.serverfilter property, it appears to set properly.
When the subroutine ends, it is still set. When I step through the last two
lines of code in the routine that calls my set_recordset subroutine and check
in the immediate window about the me.serverfilter property, it is still set.
Yet, when I see the data in the form, it isn't filtered. When I put the form
into design view, the server filter property is blank. If I directly enter a
server filter property into the form in design view and then run the code, it
disappears when the code is done executing.
I'm still trying to figure out ADP's. Any input is appreciated.
Thanks,
Andrea
Here's the code:
Sub Set_RecordSource(strServerFilter As String)
' Makes sure detail is visible and subform properly linked as connects
RecordSource
Dim blnConnectSub As Boolean
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
If Me.Detail.Visible = False Then
Me.Detail.Visible = True
Me.NavigationButtons = True
blnConnectSub = True
End If
Me.ServerFilter = strServerFilter
Set cn = CurrentProject.AccessConnection
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = "Select * from vwCollectionNoPic"
' .ServerFilter = strServerFilter
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseServer
.Open
End With
Set Me.Recordset = rs
Me.ServerFilter = strServerFilter
Set rs = Nothing
Set cn = Nothing
If blnConnectSub Then
Me.sub_frm_artist.LinkChildFields = "artist id"
Me.sub_frm_artist.LinkMasterFields = "artist id"
End If
End Sub