Dynamic Form Creation

kermit5

Registered User.
Local time
Today, 09:12
Joined
Nov 2, 2001
Messages
122
I would like to set up a form in the following manner:
My table consists of 15 different fields. The user may use anywhere from 3 to all 15 of these fields but the order of input will likely be different each time the user opens the forms (as dictated by the plans from which they are entering information).

Upon opening the form, I would like the user to view a list of available fields and from there, select which fields and in which order he/she needs to input information. The form would then allow the user to only enter information in the previously selected fields.

This is similar to the way that some fax software enables the user to select users to send a fax to and in which order to send it.

I am not sure where to start or where I can get information to assist me in this form's development.

Any help would be greatly appreciated.
 
I think you are being MUCH too good to your users! ;-)

You could set up a form containing 15 text boxes, with the label = something descriptive about the entry field, and the text box meant to hold an (optional) integer, the order of entry fields on the data entry form. The recordsource for this field might be a table with fieldnames and an integer entryorder field. After the user fills in the fields s/he wants to fill in, with the order determined by the integers entered, s/he clicks a Next button. This causes the values of all the boxes to e saved in the recordsource table.

The Next button opens a new form containing all 15 of the fields, placed anywhere, with the Visible property of each set to No. The OnOpen event for this form might go something like this (you translete to VB!):

Set an initial value for the Left and Top positions of the first visible field on the form, and a Delta, the distance between the tops of adjacent fields

Open a recordset that is something like SELECT * FROM tblWhatever ORDER BY EntryOrder

(tblWhatever is the recordsource for the previous form; EntryOrder is the integer field)

Run through the recordset and for each record:

Do Until rst.EOF

If Nz(EntryOrder,0) = 0 Then
me.tbxCorrespongingToThisRecord.Visible = False
Else
me.tbxCorrespongingToThisRecord.Visible = True
me.Sametbx.Left = intLeftPosition
me.Sametbx.Top = intTopPosition
intTopPosition = intLeftPosition + intDelta
End If

rst.MoveNext
Loop

The Eval function may be helpful in constructing field names.

Note that I've never actually done this, but it's an interesting application.

HTH,
Jim
 

Users who are viewing this thread

Back
Top Bottom