0

Anyone can help me in VB6 using DAO.
My problem is how to find record/s using different tables.

Example: After saving the data in Form1, I want to shift to form2 thru a command button in form1. When I press the command button to open form2, the code will unload form1 and open form2 using the same reference ID.

Meaning, If I'm working EmployeeID 1 in form1 after saving the data in form1, when I press the cmd buttom for form2 inside form1. The code should unload form1 and load form2with the same EmployeeID that I'm working in form1. Also will show the First Name and Last name of the same EmployeeID in form2.

Fact: The Table in form1 has the following fields: EmployeeID, First Name, Last Name, age, sex and other personal information. While in form2 the fields are EmployeeID and other Employment Information. EmployeeID in table 1 has a relationship in EmployeeID in table 2.
Please help me the code. Thank you.

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by freden
0

You need to store the employee id in a global variable declared in the module so that it stores the value across the form. You easily fetch the record using the same id in form 2.

0

Module Main

Public EmployeeID as Integer

Form1

Private Sub Command1_Click
  EmployeeID = rs.Employees("EmployeeID")
  Unload Me
  form2.show
End sub

Some good advice by debassidas. But that should get you started.

Hank

0

Thank You debassidas, how about the employee first name and employee last do i have to do the same?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.