Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

Could any body help me.

I am using ms access form and ms access as database.

I have two forms, form1 and form 2.
Form1 has text1 and button1 controls.

Here the user enters the employee id and it searches the database and finds the appropriate value and displays the other related value of that record on another form, form2.

Form2 has 3 controls, txt1, txt2 and txt3 which will display emp_id(it is used as text),name, date of birth.

Please tell me how can access form2 controls on form1 control coding?
Posted
Updated 21-Nov-10 23:01pm
v2
Comments
Dalek Dave 22-Nov-10 5:01am    
Edited for Grammar, Syntax and Readability.

pass the search string (employee id) to another form.
Suppose you have forms Form1 and Form2. You want to navigate from form1 to form2.
Do it like this,on the button click event on form one,

Form2 objForm2= new Form2(EmpID)
this.Close();
objForm2.Show();

-------------------------------------------

Now, on Form2, you can override the default form constructor method as

public Form2(String EmpID)
{
//You have got the EmpID here, fetch the data from database and display it.
}


Hope this helps. Please accept answer if it does help or revert back for any queries.

Anurag
 
Share this answer
 
v2
pass the values from form1 to form2 through one function,
eg,
Form2.fnShowValues("Emp_Id","EmpName","DOB")

so, in form 2 create one function in the name of 'fnShowValues'. then get the values and display it. after displaying give form2.showdialog()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900