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

Switchboard being open is causing run-time error on form....? 1

Status
Not open for further replies.

Nate1749

Programmer
Nov 1, 2002
204
US
The first item on the form frmMonth that you select is a combo box selecting which month it is. From there people type in their activity for the month in the boxes below... This works fine, and I had the startup options set to open this form automatically.

I decided that it would be a good idea to add a switchboard with option to run some reports so the users could run them when they wanted to. I designed the forms, setup the query criteria (with some help from fellow tek-tips member), and all of that portion works fine.

On the switchboard the first item is "data entry." You click on this and the form frmMonth opens; this was form that used to be set in startup options (it's now the switchboard form). The user selects a month from the combo box, and now it says...

"Run-time error '3021':
No current record.

When I click on debug it takes me to frmMonth, the combo box for the month, and the afterupdate event, and this line is highlighted.

Me.Bookmark = rs.Bookmark


What's strange is, if I just close the switchboard, everything works fine. Is there any reason why this is happening? I'm clueless... Did a compact & repair and that changed nothing.

-Nate
 
what is all the code in your AfterUpdate event? (before and after Me.Bookmark = rs.Bookmark)
 
Private Sub Combo2_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[MonthID] = " & Str(Me![Combo2])
Me.Bookmark = rs.Bookmark
End Sub
 
are you opening the 'dataentry' form as acFormAdd or in DataEntry mode? if so then there are no records in it's recordset for the search that you are calling for in the code.
acFormADD or DataEntry mode opens to a new record.
you should open in asFormEdit.

if this is not true, then put inside that code, things like
Code:
msgbox me!combo2
along the way (or Debug.Print and look in the Immediate Window) to see if the code is evaluating correctly. sounds like to me tho that there are no records for the search to take place in.
 
your right, I was opening it in add mode and not edit mode. Thanks.

-Nate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top