Re: Finding value in Form Load event

Tech-Archive recommends: Fix windows errors by optimizing your registry



I replaced the refrence to the [ApptCal] control in the strCriteria line with
Date.
I also replaced Set rst = Me.Recordset.Clone with Set rst = Me.Recordsetclone
Everything works correctly now.
Thank You very much for your input.
Paul

"Douglas J. Steele" wrote:

Does strCriteria get a value in the Load event?

Try putting MsgBox strCriteria after you define it to see.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Paul3rd" <Paul3rd@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C27F0602-C921-4FE9-9DF1-23F6B84A897A@xxxxxxxxxxxxxxxx
Hello, I have an Access form with a MSCAL control [ApptCal] and
a combo box control [cboApptDate].
The underlying table "ApptDis" has as it's primary key a Date/Time
field "ApptDate".
I have code in place that synchronizes the (cboApptDate] & [ApptCal]
and uses the Bookmark property to synchronize [ApptCal] & table records.
That code is:
Private Sub ApptCal_AfterUpdate()
Me.RecordsetClone.FindFirst "[ApptDate] = #" & Me![ApptCal] & "#"
With Me.RecordsetClone
.FindFirst "[ApptDate] = #" & Me![ApptCal] & "#"
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub

I'm trying to write code that will Load the form onto the record that
reflects the current Date. Such as:

Private Sub Form_Load()
Dim rst As Object
Dim strCriteria As String

strCriteria = "[ApptDate] = #" & Me![ApptCal] & "#"

Set rst = Me.Recordset.Clone
rst.FindFirst strCriteria

If Not rst.EOF Then
Me.Bookmark = rst.Bookmark
End If
End Sub

I believe my problem is in the strCriteria line, not defining the value(?)
Any help would be greatly appreciated
Paul



.



Relevant Pages

  • Re: Bookmark Failing
    ... Dim rst As DAO.Recordset ... Dim strCriteria As String ... Set rst = Me.RecordsetClone ...
    (microsoft.public.access.formscoding)
  • Re: Tab Control Code Question
    ... "DFS" wrote in message ... strCriteria = Me.tabDiscipline.Pages.Name ... This will give you the index of the selected tab: ...
    (comp.databases.ms-access)
  • Re: Tab Control Code Question
    ... Keith Wilby wrote: ... strCriteria = Me.tabDiscipline.Pages.Name ... This will give you the index of the selected tab: ...
    (comp.databases.ms-access)