'This move to a given record
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[TheNameYouAreLookingFor]='" & Me.OpenArgs & "'"
If rst.NoMatch Then
'
Else
Me.Bookmark = rst.Bookmark
End If 'If rst.NoMatch Then
rst.Close
Steve King
'This Filters
If Len(OpenArgs) > 0 Then
Me.Filter = "Name='" & OpenArgs & "'"
Me.FilterOn = True
End If Growth follows a healthy professional curiosity
I tried puttin this in my onload event for my form and couldnt get it to work.
Seems to give me error message for these two lines:
Private Sub Form_Load()
rst.FindFirst
[tt]
Private Sub Form_Load()
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[proj_poc_fnm]='" & Me.OpenArgs & "'"
If rst.NoMatch Then
'
Else
Me.Bookmark = rst.Bookmark
End If 'If rst.NoMatch Then
rst.Close
'This Filters
If Len(OpenArgs) > 0 Then
Me.Filter = "Name='" & OpenArgs & "'"
Me.FilterOn = True
End If
End Sub [/tt]
First of all remove all the section after 'This Filter because it is an alternative to using the recordset. This works fine on my Access 2000 system but I dimensioned the recordset as follows. Since ADO is the default on Access 2000 you need to do the same.
Dim rst As DAO.Recordset
And of course make sure you have the Data Access Objects (DAO) reference set.
Steve King Growth follows a healthy professional curiosity
This is one of the more common chores when doing development using COM. DAO is the language to access data and contains objects like Database, Recordset, TableDef, Fields, etc. It's is being slowly replaces by ActiveX Data Objects (ADO) which is why you need to explicitly dimension the recordset or your system, by default, will believe it needs to reference the ADO Recordset. The Data Access Objects (DAO) library is most probably on your system already. You just need to let your application know that you want to use it. To do that open a module, any module, in design mode and go to Tools\References. Scan down the list of available reference objects until you come to (probably) 'Microsoft DAO Object Library 3.6'.
Steve King ----------------------
Steve King
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.