views:

1998

answers:

4

If a form in Access DB is set as hidden. Then how to unhide it? so that we can manipulate the form programmentically using vb.net.

Thank you.

A: 

Does the form have Visible property? You can set to true to make the form visible.

shahkalpesh
Hi,Thanks for your suggestion. But I want to set Attributes property of Form to Hidden=Checked/Unchecked. It comes when we right click the form without open it in design mode.
Suman
+1  A: 

I cannot help with .net, in VBA:

Sub FormHidden()
Dim frm

    For Each frm In CurrentProject.AllForms
        SetHiddenAttribute acForm, frm.Name, False
    Next
End Sub
Remou
Thanks Remou,I will try.
Suman
A: 

Do you mean the form is open but not visible, or that the form's meta properties are set to not visible? The later is something you shouldn't do, as items set with visible off will be deleted the next time the database is compacted.

--
David W. Fenton
David Fenton Associates

David-W-Fenton
There is property of form (will get on right click) which shows Hidden check box. I want to manipulate that only using vb.net (Programmetically). If it is Hidden then uncheck it and vice-versa.Thank you.
Suman
+1  A: 

The code Remou gave should work for unhiding forms whose properties have been changed to HIDDEN in the Access UI.

In VBA, to simplify Remou's example, that would be:

SetHiddenAttribute acForm, "MyHiddenForm", False

You may be required to automate Access from VB.NET in order to accomplish this, but SetHiddenAttribute is a method of the top-level Access application object, so ought to be fairly simple to use. The value of the VBA named constant acForm is 2, so you'd likely have to call that literally, something like this:

app.Application.SetHiddenAttribute 2, "MyHiddenForm", False

where the app object has been initialized as an Access application. Dunno how that's done in VB.NET, but in VBA it would be something like:

Set app = CreateObject("Access.Application")

I'm not sure if the correct syntax would be app.Application.SetHiddenAttribute or if it would be just app.SetHiddenAttribute, but you could easily try either one.

But keep in mind, it was Remou who gave the correct answer. I'm only speculating on how to make it work in a programming environment I don't even use!

--
David W. Fenton
David Fenton Associates

David-W-Fenton