Solved

How do you get the program to remember the selected person from form to form using  a VB/Access database?

Posted on 2002-06-17
5
263 Views
Last Modified: 2010-05-02
I am trying to create a database program where the opening VB form selects the person they wish to update.  I want to be able to go from form to form with that person (person and id# are the key for each table) selected on the opening form to appear on each additional form rather than have the first person appearing on the access database to pop up.   What code do I need to include?  This is for a Visual Basic/Access database with several vb forms and access tables.
0
Comment
Question by:jclaire
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
Misledman earned 100 total points
ID: 7085451
Make a global variable in a module. Set the variable to the value chosen on the opening form. During form load of all the rest, set your parameters, whatever they may be, to those variables.

Such as :

private sub Form_Load ()

cboComboName.text = mvarName
cboComboID.text = mvarID

end sub

This may not be enough info. Let me know....
0
 
LVL 1

Expert Comment

by:HelixDaKat
ID: 7085571
I agree with Misledman
0
 
LVL 1

Expert Comment

by:Misledman
ID: 7085609
Do you need code to reposition tables/querys? If so, you using bound or unbound controls?
0
 
LVL 3

Expert Comment

by:PNJ
ID: 7087950
I agree, but I think Form_ACTIVATE event - rather than Form_LOAD to set the variables, that way if the form is already loaded and the user flicks betweens screens the data will be refreshed automatically:

Viz:
Private Sub Form_Activate()
   cboComboName.text = mvarName
   cboComboID.text = mvarID
End Sub

0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 7088957
In my opinion better options :

1. Make a global Type in a module

Type Person
  name As String
  id   As Long
End Type

Dim myPerson As Person


2. To keep everything more OO make a class CPerson
   advantage is that a class is easily extendible

0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question