Hi Mac,
Is there a way to do it so I can keep my string control?
yes, you can change the code as follows:
'~~~~~~~~~~~~~~~~~~~~
Private Function FindRecordString()
'if nothing is picked in the active control, exit
If IsNull(Me.ActiveControl) Then
MsgBox "The Search Serial Number field is blank," _
& " enter a value and try again." _
, vbExclamation + vbOKOnly _
, "Blank Field Warning!")
Exit Function
end if
'save current record if changes were made
If me.dirty then me.dirty = false
'declare a variable to hold the value to look up
Dim mStr as string
'set value to look up by what is selected
mStr = Me.ActiveControl
'clear the choice to find
Me.ActiveControl = Null
'find the first value that matches
Me.RecordsetClone.FindFirst "stringfield = '" & mStr & "'"
'if a matching record was found, then move to it
If Not Me.RecordsetClone.NoMatch Then
Me.Bookmark = Me.RecordsetClone.Bookmark
Else
MsgBox "The desired Serial Number was not found" _
& vbcrlf & vbcrlf & "--> " & mStr
, vbCritical + vbOKOnly, "No Record Found Warning"
End If
End Function
'~~~~~~~~~~~~~~~~~~~~
because this method works so well, I never use any other...
instead of just telling them the number was not found, you could ask if
they wish to add it
if MsgBox("Message" _
,vbYesNo + vbDefaultButton2 _
, "Add Record) = vbNo then exit function
Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
> Is there a way to do it so I can keep my string control? Do you have any idea
> why after a seek the absoluteposition would be the same (1) for the first two
> records and then one off (less) for all the rest throughout the recordset?
>
> Any suggestions on how to open a recordset so it supports seek and
> absolutposition (ADO)?
Mac - 13 Mar 2007 15:43 GMT
It worked! I still have other code that uses absoluteposition and now I'm
going to use bookmark instead. How do I set a form to show a bookmark once
the record is found and the bookmark is recorded in a variable?

Signature
Regards, Michael
> Hi Mac,
>
[quoted text clipped - 67 lines]
> > Any suggestions on how to open a recordset so it supports seek and
> > absolutposition (ADO)?
strive4peace - 15 Mar 2007 16:53 GMT
Hi Mac,
glad it worked for you. There is no reason to show or record the
bookmark -- it will not stay constant anyway. If you want to find the
record again, simply record the value of whatever field you used to find
it to begin with.
Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
> It worked! I still have other code that uses absoluteposition and now I'm
> going to use bookmark instead. How do I set a form to show a bookmark once
> the record is found and the bookmark is recorded in a variable?