Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass and use openargs the ADO way?

Status
Not open for further replies.

FRrogoy

Programmer
Jul 3, 2002
34
0
0
US
Is there a way to pass the key to a form (and use it to set the records available in the opened form) in ADO style? All the solutions I've seen (Including the help in Access) require the old DAO references and libraries.

Frank
 
What is the ADO way?

Since form recordsets of Access, all versions for mdb's are DAO, only DAO methods work.

If you're using adp's or have set the form recordset explicitly to ADO, then you have to use ADO methods.

Roy-Vidar
 
Please excuse my symantics. If everything is still DAO, why do I have to go check the 3.x library to use it? I'm not being a smart___, just confused. I've been suffering through MS changes from Access 2 on up!

Frank
 
Because in the 2000 and 2002 version, DAO wasn't among the default libraries, and had/has to be selected/checked if the need to use DAO arises. Perhaps an attempt to force more developers into using ADO? In 2003 it is again default, together with ADO (and the rest).

Roy-Vidar
 
What is it that you say is done in the DAO why ?

Post an example of the script that you mean.

When I use OpenArgs to control the records available on a form I don't go anywhere near anythink I'd call either DAO or ADO is I'm a bit confused about what you mean.




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Here's the event for the receiving form. (Other code is required to handle new (filtered) records.)

Private Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
Dim InID As Integer
Dim SQLwhere As String
Dim RS As DAO.Recordset
Set RS = Me.RecordsetClone
InID = Me.OpenArgs
RS.FindFirst "abcid = " & InID

If Not RS.NoMatch Then
Me.Bookmark = RS.Bookmark
End If
SQLwhere = "abcid = " & InID
DoCmd.ApplyFilter , SQLwhere
End If
End Sub

Frank
 
FindFirst and NoMatch are not methods of ADO recordsets. Alter your code. Use 'Find' and search until you reach EOF in place of 'NoMatch'.

Phil Edwards
 
Why not just do

Private Sub Form_Open(Cancel As Integer)
If Not IsNull(OpenArgs) Then
Me.Filter = "abcid = " & OpenArgs
Me.FilterOn = True
End If
End Sub



?


G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Hey, that works fine! Simple - I like that. Guess I should stay away from MS Help when I want a simple solution!

Frank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top