Re: Problem with Data Types
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Sat, 5 Jan 2008 13:20:28 +0900
If frmTo is open in its own right (i.e. not as a subform), you can refer to it using the string name like this:
Forms(frmTo)
But it would be better to pass in a reference to the form itself (ie As Form, not As String) so it works with subforms and sub-subforms.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"cinnie" <cinnie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:82CE8CBE-B70E-42D1-BCFA-02CB8B2C9C74@xxxxxxxxxxxxxxxx
hi to all
I am writing a function whose parameters are the form that is active when
the function is called (frmFROM), and the form that the function then opens
(frmTO).
My problem is that the frmTO is used as a string in line 5 and 8, but as a
form in line 6. Whichever way I Dim frmTO, I get a crash. How can reslove
this problem?
1 Function ReturnToMenu(frmFROM As Form, frmTO As String)
2 frmFROM.Visible = False
3 Dim prj As Object
4 Set prj = Application.CurrentProject
5 If prj.AllForms(frmTO).IsLoaded Then
6 Forms!frmTO.Visible = True
7 Else
8 DoCmd.OpenForm frmTO
9 End If
10 .....
much thanks
--
cinnie
.
- Follow-Ups:
- Re: Problem with Data Types
- From: cinnie
- Re: Problem with Data Types
- Prev by Date: Re: How to insert a '*' in certain controls when Enter is pressed.
- Next by Date: Re: How to insert a '*' in certain controls when Enter is pressed.
- Previous by thread: Re: How to insert a '*' in certain controls when Enter is pressed.
- Next by thread: Re: Problem with Data Types
- Index(es):
Relevant Pages
|
Loading