Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / March 2005

Tip: Looking for answers? Try searching our database.

Getting a Customer ID from one form to the next ??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Don Garry - 06 Jan 2005 05:34 GMT
I'm struggling trying to get a CustomerID from one form to another ???

Here's my situation. I have a form A which when open allows me to search for
a specific customer. Once I've found the correct customer (e.g. let's say
record #8 out of 20)  I want to pass the associated customer ID back to
another open form B.

Everything works fine as long as I don't move from the first record in Form
A. If I do move from the first record I get the customer ID for the first
record being passed back to form B rather than record #8.

I've looked at the help menus around bookmarks but just get a little more
confused.

Any assistance would sure be appreciated.
Paul Doree - 06 Jan 2005 18:08 GMT
Hi Don,

To link the two forms so that form B always displays the customer selected
on form A, use the command button wizard to generate the code - it asks you
if you want to link the two forms by a unique id e.g.:

 Dim stDocName As String
   Dim stLinkCriteria As String

   stDocName = "formA"

   stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
   DoCmd.OpenForm stDocName, , , stLinkCriteria

If you than want to insert data into form B, you need to put the following
in the before insert event of form B:

Me!CustomerID = Forms!formA!CustomerID

Make sure that form A cannot be closed whilst form B is open, otherwaise the
above will fall over.

However, if form B is already open when you select your record on form A,
base you recordset for form B on a query which gets selects the customer ID
from form A, then after selecting the record in form A, requery form B.

If you need an example of this, reply back and I'll send you a small example
DB.

Paul

> I'm struggling trying to get a CustomerID from one form to another ???
>
[quoted text clipped - 11 lines]
>
> Any assistance would sure be appreciated.
MN - 08 Mar 2005 19:03 GMT
Hi Paul,
Can you send an example, please.
Thanks a lot.

> Hi Don,
>
[quoted text clipped - 42 lines]
> >
> > Any assistance would sure be appreciated.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.