A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Locate existing record-update it on the form



 
 
Thread Tools Display Modes
  #1  
Old February 10th, 2010, 08:10 PM posted to microsoft.public.access.forms
ADB_Seeker
external usenet poster
 
Posts: 40
Default Locate existing record-update it on the form

I placed a command button on a form and want to use it to search for an
existing record and then populate the form with that record so I can
update/add to it.
The form's record source is a table (tblRFPTracking).
I'm having a mental block on how to accomplish this and appreciate any help.
Linda
  #2  
Old February 10th, 2010, 08:23 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Locate existing record-update it on the form

Here's one approach...

Add a combobox (unbound) to the form (I stick mine in the header).

Have that combobox list the records available for editing. I usually only
include the bare minimum necessary to distinguish one record from another.
Use a query to "feed" this combobox.

Use another query that returns all of the records that might go into the
form, and all of their fields that you'd want to edit.

Bind the form to that (second) query.

Now modify that (second) query to point to the combobox on the form for the
ID of the record you wish to edit. Note that this means you need to have
the first column of the (first) combobox query include the ID. You can set
the width of that first column to 0 so you don't have to see it.

One more thing ... in design view for the form, highlight the combobox and
add an Event Procedure to the AfterUpdate event. It needs:

Me.Requery

Here's the gist of how this works:

* You open the form, the combobox is empty, so the form/query returns
that record (i.e., none)
* You pick a record from the combobox and tab/enter out ...
* The form reruns the query, which now finds a value in the combobox
* The form loads the record with the ID of the record selected in the
combobox.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"ADB_Seeker" wrote in message
...
I placed a command button on a form and want to use it to search for an
existing record and then populate the form with that record so I can
update/add to it.
The form's record source is a table (tblRFPTracking).
I'm having a mental block on how to accomplish this and appreciate any
help.
Linda



  #3  
Old February 10th, 2010, 08:30 PM posted to microsoft.public.access.forms
Golfinray
external usenet poster
 
Posts: 1,597
Default Locate existing record-update it on the form

The command button wizard will do that for you. Use find record.
--
Milton Purdy
ACCESS
State of Arkansas


"ADB_Seeker" wrote:

I placed a command button on a form and want to use it to search for an
existing record and then populate the form with that record so I can
update/add to it.
The form's record source is a table (tblRFPTracking).
I'm having a mental block on how to accomplish this and appreciate any help.
Linda

  #4  
Old February 10th, 2010, 09:01 PM posted to microsoft.public.access.forms
ADB_Seeker
external usenet poster
 
Posts: 40
Default Locate existing record-update it on the form

Thank you! I knew it was something simple.
Linda

"golfinray" wrote:

The command button wizard will do that for you. Use find record.
--
Milton Purdy
ACCESS
State of Arkansas


"ADB_Seeker" wrote:

I placed a command button on a form and want to use it to search for an
existing record and then populate the form with that record so I can
update/add to it.
The form's record source is a table (tblRFPTracking).
I'm having a mental block on how to accomplish this and appreciate any help.
Linda

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.