How to send data between 2 forms?

wcoast

Registered User.
Local time
Today, 23:48
Joined
Jul 9, 2006
Messages
27
Hi,
I have 2 forms. form1 & form 2.
Form1 is full with textboxes etc, so for one task (datainput from user), i want to open a new form (form2).
1. How can I send data (in this case, a registrationID) from form1 to form2?

I would like to do it in a button click event (that opens form2, the button is placed on form1) like this: form2.textbox.value = ID, but it doesnt work. Any suggestions?

I am fairly new to Access (but familiar with VB in Visual Studio 6)
I plan to open form2 from form1 by clicking a button, i guess its therefore no "subform".
Thanks for your help !
 
Last edited:
If you're using popup forms, you can refer to this article for proper syntax. Look at "Not on those forms.." section as that applies for pop up forms.

HTH.
 
well, i dont think its a popup form, rather just a form..

Banana said:
If you're using popup forms, you can refer to this article for proper syntax. Look at "Not on those forms.." section as that applies for pop up forms.

HTH.

Thanks for your reply. To be honest, I am using Access2000 database, and in the Form section, i design the forms. I dont know if i can implement various constructors, like "new ()" and another constructor "new(byval int myindata).. to solve it.

So, please give me help, as the constructor idea, didnt work either. Thanks.
Is there a reference to a module, I shall set, to be able to program with Visual Basic in Access more like the stuff in Visual Studio? .. just wondering.
 
If you ever manage to find out how to program using Visual Studio, I would *love* to know about it. Unfortunately, VBA is pretty the only way to program Access and other MS office application with.

I think I should clarify to you at this point:

The biggest benefit of using Access is letting it do all the work of binding the data and enforcing rules. If you are not doing that, you might be as well be programming with Visual Studio with a ODBC connection to Access database (only tables will be accessible; forms and other objects won't be available) or a SQL server.

You would have more control over how your application will behave and more flexibility but also possibly significantly more development time.

Just wanted to get this cleared up before you find yourself in a deep hole. :)

As for the constructor ideas, it is supported. Whenever I have a common function that needs to be shared, I change from Private Sub to Public Sub. Mind you, if I'm on another form, I have to use the references (e.g. Call Forms!MyForm.Form!MyPublicSub), though. As for byval, I've never had to use it, but know it is also supported. Sorry I can't help you there.

But more importantly, if it's not a popup form you're referencing, what are you exactly trying to do? Maybe you are thinking that forms are the tables themselves?
 
Banana said:
If you ever manage to find out how to program using Visual Studio, I would *love* to know about it. Unfortunately, VBA is pretty the only way to program Access and other MS office application with.

I think I should clarify to you at this point:

The biggest benefit of using Access is letting it do all the work of binding the data and enforcing rules. If you are not doing that, you might be as well be programming with Visual Studio with a ODBC connection to Access database (only tables will be accessible; forms and other objects won't be available) or a SQL server.

You would have more control over how your application will behave and more flexibility but also possibly significantly more development time.

Just wanted to get this cleared up before you find yourself in a deep hole. :)

As for the constructor ideas, it is supported. Whenever I have a common function that needs to be shared, I change from Private Sub to Public Sub. Mind you, if I'm on another form, I have to use the references (e.g. Call Forms!MyForm.Form!MyPublicSub), though. As for byval, I've never had to use it, but know it is also supported. Sorry I can't help you there.

But more importantly, if it's not a popup form you're referencing, what are you exactly trying to do? Maybe you are thinking that forms are the tables themselves?


Well Banana, thanks for your thoughts. No, I don't think the forms are tables themselves. The thing is, that form1 is populated with so many inputfields, like textboxes / optionbuttons etc, that one task (inputting info that will be in another table, ) that is connected to form1, needs better to be done in a separate form.

(To put it short: I have 3 tables: Employees, Workgroups, Employee_workgroups. First i input info about 1 employee, then i want to connect him to workgroups. That info is written in the "link" table Employee_workgroups...)

well, as i am unfamiliar with access-db: I have not written any classes etc for this task. I am only editing the code that is directly connected to each form (if u know what i mean). When in design mode, i can switch to the code for that particular form. Tomorrow i am gonna try putting each forms code into publicly declared, i.e. from "private sub.." to "public sub.."

enough said. You are right, its probably the right term to call form2 a popup-form.
Back later, and tell you and others how it develops.. ;)
 

Users who are viewing this thread

Back
Top Bottom