Re: Finding value in Form Load event
- From: Paul3rd <Paul3rd@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 27 Sep 2007 10:15:03 -0700
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
- References:
- Finding value in Form Load event
- From: Paul3rd
- Re: Finding value in Form Load event
- From: Douglas J. Steele
- Finding value in Form Load event
- Prev by Date: Re: Please Help! I want to turn my old PC into a File Server
- Next by Date: use combo box value to move to record
- Previous by thread: Re: Finding value in Form Load event
- Next by thread: Re: mobile home lease,
- Index(es):
Relevant Pages
|