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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3021

Status
Not open for further replies.

vicktown

Technical User
Jul 13, 2004
27
CA
I have created a form where i can scroll a drop down list of items. I can then chose an item and then use another drop down menu to chose another item. This form works perfectly when i open it from the main data base window and displays that there are 388 records. When i open this form from inside the application and i select any item from the first drop down menu it gives this message:

Run-time error 3021
No currrent record found.

The bottom of the form also indicated i only have 1 record available.

Why is this form working from the database window but not when it is called from a program? How can i fix this?

This is the coding for the modules:


Option Compare Database
Option Explicit


'After Update on drop down menu

Private Sub Combo2_AfterUpdate()
Dim strFind As String
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ShortName] = '" & Me![Combo2] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
strFind = "SELECT DISTINCTROW [tblAssessments].[AssessID] FROM [tblAssessments] WHERE [tblAssessments].[LegislationKey] = " & Me.RecordsetClone!LegislationID & " ;"
Me.Combo6.RowSource = strFind
End Sub
 
It sounds like the form is set to data entry mode, and only allows the user to view the records entered during that session, and not all records. Try changing data entry to false, or some other similar option. I'd try chaning "data entry" mode to false/no first, and see if that fixes it.

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Thanks for teh effort but data entry for this form is already set to NO.

Any more ideas?

Am i clearly describing my problem?
 
Did you manually type in the record source, or did you select it by browsing? Did you change the table/query name after you already created the link from the form?

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Like i said, the form works perfectly when called from the database window. Nothing is changed, but when i open it from another form, it lists the correct information, but gives me an error when i select it.

I have changed no names and i selected the record source by browsing. I have no clue why this is happening
 
the form works perfectly when called from the database window

So is the CODE that is in the button's ON Click event causing the form to open in DataEntry mode ?

Does it say "acFormAdd" after the fourth comma in the Docmd.OpenForm line ?






G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
The problem arises when I access the form's drop down menu. The drop dow list populates with the correct information but when i select an item from the list i get the 3012 error message. Again, only when i call the form from a menu form.

As for yor question, there are only 3 commas in that line, and "acFormAdd" is not included.
 
The easy explanation is that your combo is populated correctly, but the form isn't (does only contain one record, probably just a new record), so when the .FindFirst executes, it finds no records. When trying to assign the bookmark of no record, usually the 3021 occurs.

Alter the .FindFirst to:

[tt] Me.RecordsetClone.FindFirst "[ShortName] = '" & Me![Combo2] & "'"
if not me.recordsetclone.nomatch then
Me.Bookmark = Me.RecordsetClone.Bookmark
else
msgbox "no records found"
end if[/tt]

Now the next question - why is it only one record (or no records) in the form when opening it thru some other form? I have no idea with the information posted, you wouldn't care to share your code? Do you have any filter, filter name... There is probably something there causing the form to open without records (as stated by LittleSmudge) - but it is rather hard to see with the available information...

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top