Using recordsets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is basics stuff - but trying to understand. If I run this, I get
expression type mismatch at the set rst statement. I can't even get to the
with statement. I eventually need to get to a place where the user chooses
an entity with comob0, then this code will determine if there is already a
record there, if there is, display it, if not, make a new record. Just
trying to get started.

Public Sub Combo0_AfterUpdate()

Dim rst As Recordset
Set rst = Me.RecordsetClone

MsgBox Combo0

'With rst
' .Findfirst "txtAE = " & Combo0
' If rst.nomatch = False Then
' Me.Refresh
' MsgBox "Found it"
' Else
' MsgBox "nope, just not here"
' End If
'End With


End Sub
 
If you are using A2K or newer, do you have a reference set to Microsoft DAO 3.6
Object Library and is it above the reference to ADO?

If [txtAE] datatype is a long integer, then the code (below) works

'****beg code ******
Public Sub Combo0_AfterUpdate()

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone

MsgBox Combo0

With rst
.FindFirst "txtAE = " & Combo0
If rst.NoMatch = False Then
Me.Refresh
MsgBox "Found it"
Else
MsgBox "nope, just not here"
End If
End With

rst.Close
Set rst = Nothing
End Sub
'****end code ******

HTH
Steve S.
 
I do not know how to answer that. What I found works is not using proper
technique and simply using the me.recordsetcloen.findfirst instead of
substituting. But since I was using:

dim rst as recordset

and not

dim rst as dao.recordset

that might make a difference. I will work with that some tonight. thanks
--
Ficticiously Yours, Biggles


SteveS" <"sanfu at techie dot com said:
If you are using A2K or newer, do you have a reference set to Microsoft DAO 3.6
Object Library and is it above the reference to ADO?

If [txtAE] datatype is a long integer, then the code (below) works

'****beg code ******
Public Sub Combo0_AfterUpdate()

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone

MsgBox Combo0

With rst
.FindFirst "txtAE = " & Combo0
If rst.NoMatch = False Then
Me.Refresh
MsgBox "Found it"
Else
MsgBox "nope, just not here"
End If
End With

rst.Close
Set rst = Nothing
End Sub
'****end code ******

HTH
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
This is basics stuff - but trying to understand. If I run this, I get
expression type mismatch at the set rst statement. I can't even get to the
with statement. I eventually need to get to a place where the user chooses
an entity with comob0, then this code will determine if there is already a
record there, if there is, display it, if not, make a new record. Just
trying to get started.

Public Sub Combo0_AfterUpdate()

Dim rst As Recordset
Set rst = Me.RecordsetClone

MsgBox Combo0

'With rst
' .Findfirst "txtAE = " & Combo0
' If rst.nomatch = False Then
' Me.Refresh
' MsgBox "Found it"
' Else
' MsgBox "nope, just not here"
' End If
'End With


End Sub
 
Back
Top