Creating forms on the fly using a control file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Attempting to create Access forms (2002 or 2003) on the fly using an external
control file. Each control file will define all data fields (for a given
form) including attributes (and edit/update rules) as needed. Each data field
will be "Unbound" and will be filled as needed from the Access data base
using edit rules in control file.
The control file will be modified (data fields be altered or removed) BEFORE
form is created based on user priviliges. One more complication: Procedure
must run with MDE.
Am currently doing above with a major application (several hundred programs)
running compiled QBasic. Any help would be greatly appreciated. jnh11
 
jnh11 said:
Attempting to create Access forms (2002 or 2003) on the fly using an
external control file. Each control file will define all data fields
(for a given form) including attributes (and edit/update rules) as
needed. Each data field will be "Unbound" and will be filled as
needed from the Access data base using edit rules in control file.
The control file will be modified (data fields be altered or removed)
BEFORE form is created based on user priviliges. One more
complication: Procedure must run with MDE.
Am currently doing above with a major application (several hundred
programs) running compiled QBasic. Any help would be greatly
appreciated. jnh11

Ain't gonna happen. Impossible in an MDE and impractical in an MDB.
 
jnh11 said:
Attempting to create Access forms (2002 or 2003) on the fly using an
external
control file. Each control file will define all data fields (for a given
form) including attributes (and edit/update rules) as needed. Each data
field
will be "Unbound" and will be filled as needed from the Access data base
using edit rules in control file.
The control file will be modified (data fields be altered or removed)
BEFORE
form is created based on user priviliges. One more complication: Procedure
must run with MDE.
Am currently doing above with a major application (several hundred
programs)
running compiled QBasic. Any help would be greatly appreciated. jnh11

That may have been an appropriate solution in QBasic; it almost certainly is
not an appropriate solution in Access. Unbound forms can be done in Access;
almost certainly, using unbound Forms to enter, manipulate, and display data
is not the best way.

If you'd explain what you have, and what you are trying to accomplish,
rather than how you had decided to implement it, perhaps someone could offer
useful suggestions.

Larry Linson
Microsoft Access MVP
 
jnh11 said:
Attempting to create Access forms (2002 or 2003) on the fly using an external
control file. Each control file will define all data fields (for a given
form) including attributes (and edit/update rules) as needed. Each data field
will be "Unbound" and will be filled as needed from the Access data base
using edit rules in control file.
The control file will be modified (data fields be altered or removed) BEFORE
form is created based on user priviliges. One more complication: Procedure
must run with MDE.
Am currently doing above with a major application (several hundred programs)
running compiled QBasic. Any help would be greatly appreciated. jnh11

Hello jnh11,

I'm not sure if that is what you want, but if I understand well, you
have to get "custom input fields" for your form. A possible workarround
is the following:

Make a form with enough unbound text boxes for your input data. Doesn't
matter how the controls are named. Set all fields to VISIBLE=FALSE.
Modify this code accordingly to your data and place it in the Load
event of your form.

Private Form_Load()
dim SelectList as String
dim iFieldCount as integer, i as integer
dim ctl as control
dim rs as recordset

SelectList = "Select * FROM MyView" 'Suppose you know how to define a
custom view dinamically

Me.RecordSource = SelectList
Me.Requery

Set rs = New Recordset '(or ADODB.Recordset if your sollution is ADO
based)
Set rs = Me.Recordset

iFieldCount = rs.Fields.Count
For Each ctl In Me.Controls

If (iFieldCount > i) Then
Select Case ctl.ControlType
Case Is = acTextBox
If ctl.tag = "Your specific condition based on qBasic
control file"
ctl.Visible = True
ctl.ControlSource = rs.Fields(i).Name
ctl.Requery
Else
ctl.Visible = False
End If

Case Is = acLabel
ctl.Visible = True
ctl.Caption = rs.Fields(i).Name

i = i + 1
End Select
End If
Next ctl

That should work even with an MDE. The ideea of this workarround is to
make a custom select list based on external input conditions and then
set it to be your's form recorsource.
There are many possible aspects you shoud care about if you want to set
the permissions for the users but if you explain much detailed perhaps
I (or someone else) can help you.


Dragos
 
Back
Top