Disable filter when opening form

Armitage2k

Registered User.
Local time
Tomorrow, 02:35
Joined
Oct 10, 2009
Messages
34
Open form to a specific Record, but show all records?

Hi,

I have 2 forms, which are showing me my client information. the form Client List shows me only few information in a list, the form Client Details shows me detailed information for a specific client.
when clicking the ClientID field of my client in the list, I wish to open the Client Details form displaying me details for the clicked client. However, when opening the form, I wish to have it not filtered, so that I CAN scroll through to other clients.

The VBA code I am using however opens the form and the client correctly, but doesnt let me scroll through.
Code:
DoCmd.OpenForm "Client Details", , , "[ClientID]=" & Me.[ClientID]

I found another piece of code which finds the record in the RecordsetClone of the form after I opened it, hence should solve exactly that problem, but instead gives me a type mismatch in criteria expression error:
Code:
Dim strWhere As String
Dim rs As DAO.Recordset
strWhere = "[ClientID] = '" & Me.[ClientID] & "'"
DoCmd.OpenForm "Client Details"
With [Forms]![Client Details]
Set rs = .RecordsetClone
[B][COLOR="Red"]rs.FindFirst strWhere[/COLOR][/B]
If rs.NoMatch Then
MsgBox "Not found"
Else
.Bookmark = rs.Bookmark
End If
End With
Set rs = Nothing
Code:
Any ideas on how I can accomplish that?
Thanks,
A2k
 
Last edited:
I found it myself.

The difference between those 2 tables is that one ID field is a numeric value, hence does not need the " ' " in the code. this one works fine now:
Code:
strWhere = "[ClientID] =" & Me.[ClientID]

cheers,
A2k
 

Users who are viewing this thread

Back
Top Bottom