No Current Record? (1 Viewer)

L4serK!LL

Registered User.
Local time
Today, 22:51
Joined
Jul 22, 2002
Messages
59
Code:
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Tikking")
'rst.MoveLast
rst.MoveFirst
While (rst![ID] <> tikking)
    rst.MoveNext
Wend
... ain't working because I get "No Current Record" on the while line :(
(the table "Tikking" got about 9000 records so not a chance it's empty :p )

What should I do?
 

Fizzio

Chief Torturer
Local time
Today, 22:51
Joined
Feb 21, 2002
Messages
1,885
Have you declared what tikking is in
'While (rst![ID] <> tikking)' and is ID the correct field to compare.
Also it will keep looping until it finds a match for <>tikking. If it reaches rst.EOF before finding a match, there will be no currect record, hence the error.
 

L4serK!LL

Registered User.
Local time
Today, 22:51
Joined
Jul 22, 2002
Messages
59
'tikking' is the dropdown box, the piece of code comes from the AfterUpdate of tikking...

Code:
While ((Not rst.EOF) And rst![ID] <> tikking)
... gives me the same error :(
 

Fizzio

Chief Torturer
Local time
Today, 22:51
Joined
Feb 21, 2002
Messages
1,885
Have you tried

While ((Not rst.EOF) And rst![ID] <> Me.tikking)

(Also, have you changed the recordsource of the form recently?. To be safe, remove the recordsource of the form, save it, reset the recordsource of the form and save it again.
Check that the table name is not a typo also;))

If you are trying to find a particular record in the recordset, look up the findfirst method in help.
 

L4serK!LL

Registered User.
Local time
Today, 22:51
Joined
Jul 22, 2002
Messages
59
Fizzio said:
If you are trying to find a particular record in the recordset, look up the findfirst method in help.
I am indeed but access tells me I can't use the FindFirst method as it is not supported for this type of objects or something like that :(
 

Fizzio

Chief Torturer
Local time
Today, 22:51
Joined
Feb 21, 2002
Messages
1,885
Is the recordsource for the form the table "Tikking"?

If so, this line will find a record in a form.

Me.RecordsetClone.FindFirst "[ID] = " & Me.tikking

If you are looking to something other than finding a record in a form, get back.
 

cogent1

Registered User.
Local time
Today, 22:51
Joined
May 20, 2002
Messages
315
It would make life less confusing if your table was called tblTikking and your combo was called cboTikking. Not that this helps with your current problem...
 

Users who are viewing this thread

Top Bottom