Qbasicnews.com

Full Version: VB6 Multiple form field questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Don't rtfm me on this, I'm sure it's simple, but I've only been progging in vb6 for a few days and haven't had the time yet to rtfm. So.
I'm writing a simple database program that takes some information, phone #, address, etc. My problem is that the fields in which you enter your data is on seperate forms. And in the last form, you type in a filename to save your data to. But I can't access stuff like form1.nameInput.Text from form3! Is it possible to keep the data available without having the form showing?
BTW, I already tried loading the other forms that have the text fields in them and just setting their Visible property to False. It still doesn't work.
If you need the project file, just tell me and I'll post a link to it...
You can link to the other forms... Tongue

Ok, this is a more efficient way:
- Create a module (right click on your project tree, highlight add, then click module, choose a standard module).
- e.g. add this code:
Code:
Public strPhone As String
Public strAddress As String
Public strName As String
etc.etc.etc.
- By having declared these variables public, you can access all these variables in every form in your project.

Here's the code of an example form:
Code:
Dim strAns As String
Do
   strAns = InputBox("Insert your telephone number", "Telephone", "000-0000000")
Loop Until LtRim(RtRim(strAns)) <> ""
'call a function to check if the entered phone number is valid

'now store
strPhone = strAns

Wink
Thanks Smile
No prob. Hope it works Wink