Form design in accde (1 Viewer)

CedarTree

Registered User.
Local time
Today, 03:12
Joined
Mar 2, 2018
Messages
404
Hi - rather than have 2 versions of a form depending on the type of project we're running, in my accdb file, I modify the design of the form in VBA ( I open the form in design view) and then open the form in normal view. But accde doesn't allow form design in VBA (I think). Is there any way around this? I like accde since it keeps people out of the code, etc. Thanks!!!
 

Minty

AWF VIP
Local time
Today, 08:12
Joined
Jul 26, 2013
Messages
10,371
Nope.
All design methods are not available in accde as it compiled and then saved in the compiled state.

Why not save the second form version and just use that based on selecting something or looking something up when on opening the database?
Changing form design on the fly is extra work, and fraught with potential pitfalls.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:12
Joined
Feb 19, 2002
Messages
43,293
You can show/hide controls without changing the design. That might solve the problem. Otherwise, if you have to make two forms to update the same table, modularize the validation code so that you have only ONE version of it that is used by both forms.
 

CedarTree

Registered User.
Local time
Today, 03:12
Joined
Mar 2, 2018
Messages
404
I change item sizes and visible settings mostly I think.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 02:12
Joined
Feb 28, 2001
Messages
27,191
In terms of effort, it is probably better to do something like this:

First, working in the ACCDB file, make a form that does what you want for some people. Call it some name with a 1 at the end, like SpecialForm1.

Next, copy the form and edit it so it does what you want for other people. Call it some name with a 2 at the end, like SpecialForm2.

IF you have some code that would be common to both, make that code generic and pass in the form name (or the form itself ByRef) so the code knows which form it is using.

Now at the point where you would open one form or the other, first decide which of the two forms you will be opening. No form control manipulation, no form diddling, nothing that would make an ACCDE file barf. And the less run-time manipulation you do, the safer and saner your application will run.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:12
Joined
Feb 19, 2002
Messages
43,293
If the variable sections of fields can be isolated, you can hide the whole group by putting a large, opaque box over them and just using bring to front or send to back on the box. The other easy method is to put something in the tag property of each control that is variable. This method is preferred if you can't segregate the controls you want to show hide. You then use a loop to cycle through the controls collection and toggle the visible property of those controls with tags. Put this code into the Current event of the record so if the properties are controlled by data rather than by user, the properties can change with each record. If the properties are controlled by the logged in user, then use the load event of the form to handle the show/hide using either method.
 

Users who are viewing this thread

Top Bottom