Get the info frm Mod to form

G

Gib

Good day to all,

I am trying to use a module to make a subform visible or
not depending on values of fields in the main form.

I have been able to work in the module with:

Var1=dlookup("Field","Tbl", "id=" Forms!Form1.Field)

If Var1 = "X" then Count=Count+1

Var2 =dlookup(etc.)

The goal is :
If Count=y then
Subform.visable=True
Else: Subform.visable=False

Any help would be appreciated.
 
W

Wayne Morgan

You also need to pass the routine in the module the name of the subform
control you want to make visible. The syntax would then be:

Forms("NameOfForm").Controls("NameOfSubformControl").Visible = True

Example:
Public Sub MakeSubVisible(strNameOfForm As String, strNameOfSubControl As
String)
.......
Forms(strNameOfForm).Controls(strNameOfSubControl).Visible = True
.......
End Sub

You can pass more parameters than this, but for the visible portion, you'll
need these two.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top