[AccessD] FindFirst Not Working

Max Wanadoo max.wanadoo at gmail.com
Sun Jul 12 12:12:53 CDT 2009


Also, further to William, is it numeric or text.
If text, it needs quotes.

Assuming your cbo has a recordset where the first item is the PO and the
second or subsequent items are what the user sees.  If the user sees the
first item (column(0)) then you don't need to put the column(0) bit in, just
me!cboFindPO

Also, I find it more stable to put the search term into a variable and not
directly as you have coded it.

I would use the onchange and not the afterupdate...

Private Sub cboFindPO_OnChange()
Dim rst as dao.recordset, strFind as string
Set rst = me.recordsetclone
strFind = "fldPHHID=" & me!cboFindPO
rst.findfirst strfind
if not rst.nomatch then
  me.bookmark = rst.bookmark
else
  msgbox "Ooops, where did it go?"
end if
set rst = nothing
 End Sub


ALL the above is air code.

Max


-----riginal Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William Hindman
Sent: 12 July 2009 17:45
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] FindFirst Not Working

...is your column id correct? ...Column(1) vs Column(0)
William

--------------------------------------------------
From: "Rocky Smolin" <rockysmolin at bchacc.com>
Sent: Sunday, July 12, 2009 9:47 AM
To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
Subject: [AccessD] FindFirst Not Working

> Dear List:
>
> Legacy app.  I added a form to make purchase orders. In the AfterUpdate
> event of the combo box which finds an existing purchase order I added the
> following:
>
>
> Private Sub cboFindPO_AfterUpdate()
>    Me.Recordset.Clone.FindFirst "fldPOHID = " & Me.cboFindPO.Column(0)
>    MsgBox Me.RecordsetClone.NoMatch
>    Me.Bookmark = Me.RecordsetClone.Bookmark
>    Me.Refresh
> End Sub
>
> But the form does not move to the selected Purchase Order.
>
> I put in the MsgBox just to make sure NoMatch was False.  I added the
> Refresh to see if that was the problem.
>
> Does anyone see a reason why this shouldn't work?
>
> MTIA,
>
> Rocky
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list