Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide the open form, display new form and get values from hidden

Status
Not open for further replies.

AccessGuruCarl

Programmer
Jul 3, 2004
471
US

I'm stumped...

how do "hide" the open form, open another form, and still retrieve values from the hidden form.

Thanks in advance.....

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Something like this?

Code:
Private Sub cmdOpenForm_Click()
    DoCmd.OpenForm "Employees"
    With Forms!Employees
        .SetFocus
    End With
    With Me 'This form
        .Visible = False
    End With    
End Sub
for the second form...
Code:
Private Sub Form_Open(Cancel As Integer)
    Me.TextBox1.Value = Forms!FirstForm.TextBox1.Value
End Sub



________________________________________
Zameer Abdulla
Visit Me
A child may not be able to lift too much.
But it can certainly hold a marriage together
 
How are ya AccessGuruCarl . . . . .

[ol][li]Open the 2nd form.[/li]
[li]In the Open event of the 2nd form, close the 1st form.[/li]
[li]Form the 2nd form, reference the 1st with typical form referencing:
Code:
[blue]   Me!ControlName = Forms!1stFormName!ControlName[/blue]
[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
I'm perhaps a little simplistic:

[tt]me.visible=false
docmd.openform "frmTheOtherForm"[/tt]

Then you should be able to pick info using ordinary form references, though for safety, check if the form is loaded.

You can use the openargs arguement when opening the form too.

Roy-Vidar
 
Thanks All,

TheAceMan1 was what I was looking to confirm?

Turns out, another user renamed some of the 'Controls' without telling anyone? This really got me peeved...

After seeing the response's I knew the code was right, which lead to start tracing through the controls.

Thanks...


AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
AccessGuruCarl said:
another user renamed some of the 'Controls' without telling anyone?
Act right now.. tighten your security before the user rename any more controls and objects and make you....

________________________________________
Zameer Abdulla
Visit Me
A child may not be able to lift too much.
But it can certainly hold a marriage together
 
AccessGuruCarl . . . .

Actually 2 in my post should've been:
[ol][li] . . .[/li]
[li]In the Open event of the 2nd form, [purple]hide[/purple] the 1st form.[/li][/ol]
In parallel with [blue]ZmrAbdulla[/blue], absolutely tighten-up your security.

Now . . . not only locking users out of design changes, I've learned to [purple]Never Allows Users Any Option to Delete a Record(s).[/purple] I have a popup that advises them to [blue]contact administration[/blue] for this! . . . . ya never know . . .


Calvin.gif
See Ya! . . . . . .
 
To the ACEMan1,

Sounds like a great idea, only their is 3 different groups(depts) working on this program.

suppose to work in their own copy, I was told they were viewing code, and forgot what db they were in!

Once the db is complete they want to merge everything to one.

Certianly not the best way to write a program, but that's what they wanted!

Thanks again....

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
I like to close unwanted forms unless they are part of a path whereby you will be returning to the previous form after the new form closes.

If you do not plan to return to the first form when the new form is closed and simply want to pass values then consider this.

I use a table with a single record to store the data I want to pass prior to opening the next new form. (in a multi-user environment add an extra field for the userID and the others for their selected 'working record' and whatnot that needs to be available anywhere) This is easier than trying to manage global variables in my opinion.

This can then always be tapped with a simple Dlookup to yank the current working record or other passed values and filter or move to the desired record on any form in the system. This way if the current form gets closed does not matter and you dont need to try to manage all the hidden forms which appear closed but are not (probably not ideal for performance either)
 
[blue]Sounds like a great idea, only their is 3 different groups(depts) working on this program.[/blue]
If necessary, you can redesign the DB just like it was. [purple]You can't redesign lost data![/purple] Believe me, if this ever happens (I've been in court twice in the past for just this problem), [purple]everyone in every group will be pissed and looking for you![/purple]

Albeit, it'll piss them off. [purple]But it'll never compare to how pissed you'll get when they try to make it your fault![/purple]

After all . . . . . they pass themselves off as the most intelligent crew you could run across . . . . so why should there be a problem with this . . . . intellgent people like them don't make mistakes!

The two cases I was involved in, involve people who knew they were going to be laid off . . . . and they got even . . . . deleted it all!

[purple]So as the designer . . . . its your call![/purple]

Calvin.gif
See Ya! . . . . . .
 
AccessGuruCarl . . . . .

Hit submitt too soon . . . .

Some one or several people from each group to should be assigned to take care of this . . . .

[purple]If not . . . just realize . . . . your leaving yourself open![/purple] . . . . and I hope your prepared!

Calvin.gif
See Ya! . . . . . .
 
I tried the simplex
me.visible = False in numerous events in the form OPEN, LOAD, etc. and none of them would work.

I any case I am trying to have the form close itself immediately afer being opened. The only Event I have activated is OnTimer.
 
Not suggesting that you want to do it in this case, but it is something to keep in mind that is possible. Since a Form's module is a class module like any other class module you can declare public varables and properties. So in form frmTwo you could define:

public strCallingFormsName as string
public rsCallingFormRecordset as dao.recordset

From the first form, frmOne you could set these variables after opening frmTwo

frmTwo.strCallingFormName = me.form.name
frmTwo.rsCallingFormRecordset = me.recordset

Now you can close frmOne, but frmTwo can use its recordset. Truthfully, never done it with a recordset, but I have done this often with other objects, and I assume it would work. You can get fancier and put let, get, and set procedures in your form's module.
 
I have done this often with other objects
Without the Set instruction ?
 
Yeah, you got me. Forget the Set, but I still think it is an important concept to keep in the toolbox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top