VB error 2137 when trying to add second subform to main form

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

Guest

Hi,

I have created two call logs for retail sales people to record various
things. One call log is for phone calls they make while the other is for
check ins and check outs. These call logs are both sub forms that are on a
main form. Each call log is based on tables that have records for each day
of 2006. I have coded it so that it opens to todays date. It worked fin for
the first call log but when I tried to add the second call log I am getting a
Microsoft Visual Basic erro that states: Run Time error r2137. You can't
use Find or Replace. When I click on debug here is the code that is listed.
-------------------------------------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)

Me!BusinessDate.SetFocus
DoCmd.FindRecord Date
Me!NumberCheckouts.SetFocus
End Sub
--------------------------------------------------------------------------------------------

The DoCmd.FindRecord Date is highlighted in yellow. I would like both call
logs in the subforms to open to today's date. When I click on each sub from
directly they work this way but when I try to add them as sub forms to the
main form I get the error. Can someone help?

Thanks,

--
Chuck W
Was this post helpful to you?

Why should I rate a post?



Expand AllCollapse All
 
Try moving your code to the Load event.
I would try this code instead:

Set rst = Me.RecordsetClone
rst.FindFirst "[DateFieldName] = #" & Date & "#"
If rst.NoMatch Then
MsgBox "Current Date is Not in the Table"
Else
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
Me!NumberCheckouts.SetFocus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top