run time error 429

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

Guest

Im new Access user and I don't understand where I mistaken. Following are
sample from textbook:

Private Sub EesnimeKast_BeforeUpdate(Cancel As Integer)
Dim k As Recordset


If IsNull(PerekonnanimeKast) Then Exit Sub
If IsNull(EesnimeKast) Then
Cansel = True
End If

Set k = CurrentDb.OpenRecordset( _
"SELECT * FROM Kliendid WHERE Perekonnanimi='" & PerekonnanimeKast & _
"' AND Eesnimi='" & EesnimeKast & "'")

If k.RecordCount = 0 Then
Cansel = True
Exit Sub
Else
k.MoveLast
End If

If k.RecordCount > 1 Then
MsgBox "Valitud ole üheselt määratud!", _
vbCritical, "Müügiandmete vaatlemine"

Exit Sub


The line of code which generates the error
message is:

Set k = CurrentDb.OpenRecordset( _
"SELECT * FROM Kliendid WHERE Perekonnanimi='" & PerekonnanimeKast & _
"' AND Eesnimi='" & EesnimeKast & "'")

What is wrongly
Thanks for any ideas
 
Jaan said:
Im new Access user and I don't understand where I mistaken. Following are
sample from textbook:

Private Sub EesnimeKast_BeforeUpdate(Cancel As Integer)
Dim k As Recordset


If IsNull(PerekonnanimeKast) Then Exit Sub
If IsNull(EesnimeKast) Then
Cansel = True
End If

Set k = CurrentDb.OpenRecordset( _
"SELECT * FROM Kliendid WHERE Perekonnanimi='" & PerekonnanimeKast & _
"' AND Eesnimi='" & EesnimeKast & "'")

If k.RecordCount = 0 Then
Cansel = True
Exit Sub
Else
k.MoveLast
End If

If k.RecordCount > 1 Then
MsgBox "Valitud ole üheselt määratud!", _
vbCritical, "Müügiandmete vaatlemine"

Exit Sub


The line of code which generates the error
message is:

Set k = CurrentDb.OpenRecordset( _
"SELECT * FROM Kliendid WHERE Perekonnanimi='" & PerekonnanimeKast & _
"' AND Eesnimi='" & EesnimeKast & "'")


What data type are the Perekonnanimi and Eesnimi fields? If
a field is a numeric type then you should not use ' around
the value.
 
Hi
Both are text type.

The Sample is wrote by Access 97. I use Access 2000. Is there are
differentses.



"Marshall Barton" kirjutas:
 
The big difference is that A2k has ADO as the default data
library, while A97 had DAO as the default library. Check
your library references (Tools menu in VBE window). If you
didn't intend to use ADO, uncheck that reference and check
DAO. If you are using both, then you should disambiguate
the conflicting declarations. E.g.

Dim k As DAO.Recordset
 
Hi March

I coped herewith. Thanks for consulting.

Jaan



"Marshall Barton" kirjutas:
The big difference is that A2k has ADO as the default data
library, while A97 had DAO as the default library. Check
your library references (Tools menu in VBE window). If you
didn't intend to use ADO, uncheck that reference and check
DAO. If you are using both, then you should disambiguate
the conflicting declarations. E.g.

Dim k As DAO.Recordset
--
Marsh
MVP [MS Access]

Both are text type.

The Sample is wrote by Access 97. I use Access 2000. Is there are
differentses.



"Marshall Barton" kirjutas:
 
Back
Top