[AccessD] VBA syntax for selecting a record

JWColby jwcolby at colbyconsulting.com
Fri Jan 19 00:14:15 CST 2007


John,

This is one of the methods of "pushing" a value back to the calling form and
forcing it to move.  Of course this requires the currently open form to
"know" who opened it.  If this is hard coded that is fine, or the calling
form could be passed in as an OpenArg.  You do need to be careful where you
call this method from however since if called too late (as the form is
closing) me.txtKey may not have a valid value. 


John W. Colby
Colby Consulting
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
Sent: Friday, January 19, 2007 12:54 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] VBA syntax for selecting a record

Well I don't reckon it'd be much different. Try

With Forms("Yourformname").Form
  .RecordSetClone.FindFirst "YourPrimaryKeyField=" & Me.txtKey
  If Not .RecordSetClone.Nomatch Then
    .BookMark=.RecordSetClone.BookMark
  End If
End With


-- Andy Lacey
http://www.minstersystems.co.uk 


> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Bartow
> Sent: 19 January 2007 04:47
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] VBA syntax for selecting a record
> 
> 
> Hi Andy,
> Thanks but I should've have been more specific (got a head cold and 
> not thinking real clear :o(
> 
> What would be the correct VBA syntax for selecting a record on a 
> continuous form using the primary key from a separate module be (not 
> the form's own module).
> 
> Here's what I'm after: I'm on a specific form and I change the record 
> being worked on via code. I want to have the selected record be the 
> same on another open form (which precedes this form in the work flow). 
> That form displays the same set of record using the continuous form 
> style.
> 
> I want to do this so that when the current form is closed the other 
> form appears to be highlighting the same record that I switched to on 
> the form that was just closed.
> 
> I hope that is clearer.
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
> Sent: Thursday, January 18, 2007 4:01 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] VBA syntax for selecting a record
> Importance: High
> 
> John
> It'd be something like:
> 
> With Me.RecordSetClone
> .FindFirst "YourPrimaryKeyField=" & Me.txtKey If Not .Nomatch Then 
> Me.BookMark=.BookMark End If End With
> 
> 
> Assumes a field like txtKet holds the record number sought
> 
> --
> Andy Lacey
> http://www.minstersystems.co.uk
> 
> 
> 
> 
> --------- Original Message --------
> From: "Access Developers discussion and problem solving" 
> <accessd at databaseadvisors.com>
> To: "'Access Developers discussion and problem solving'" 
> <accessd at databaseadvisors.com>
> Subject: [AccessD] VBA syntax for selecting a record
> Date: 18/01/07 09:38
> 
> 
> What would be the correct VBA syntax for selecting a record on a 
> continues form using the primary key?
> 
> TIA
> John B.
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> ________________________________________________
> Message sent using UebiMiau 2.7.2
> 
> --
> 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
> 
> 


--
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