"Musk" Form

  • Thread starter Thread starter an
  • Start date Start date
A

an

Hello!

Two questions with connection:

I have many Forms because there are litle "nuances"
between they, as a result of different tables, with
differents fields.

1 - Are there some procedure (?) to optimize this, to
force only one "mask" Form read different tables, please?

2 - If the previous question is possible, is don't
possible in each form, to show or not, the fields which
don't exist in each table/record, with

If [Field] = "..." Then
[Field].Visible = True

?
Any help is welcome.
Thanks in advance.

an
 
Both solutions are possible. For #1, change the Recordsource property of the
form in the code that opens it. For #2, your syntax is close:

If Me.[ControlName] = "..." Then
[ControlName].Visible = True
Else
[ControlName].Visible = False
End If

I'd also check out your tables to see if those "nuances" require multiple
tables, or additional fields are the right design. In general, a table
describes an entity and fields describe attributes of that entity. So, for
instance both customers and suppliers can both go in the same table (they
are companies or people) but require a few fields to describe their
differences.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
You can reset a form's Recordsource in code. However, you can run into
problems if you've got controls on the form that are bound to fields that
don't actually exist in the recordset. Toggling the control's visibility
isn't really sufficient: you should also change the field's control source
(to make it unbound).

In your form's Open event, you can have code like:

Select Case WhatForm
Case 1
Me.RecordSource = "qryABC"
Me.txtField1.ControlSource = "City"
Me.txtField1.Visible = True
Case 2
Me.RecordSource = "qryDEF"
Me.txtField1.ControlSource = vbNullString
Me.txtField1.Visible = False
End Select
 
Thanks for your reply.

#2 - Ok!

#1 - This is what I have. One form to each table. From
where... many identical forms.
My question is another:
If is possible we have only one "mask" form, to all tables
and, anyway, to have any indicator to read certain table
according to different situation?
Thanks.
an
-----Original Message-----
Both solutions are possible. For #1, change the Recordsource property of the
form in the code that opens it. For #2, your syntax is close:

If Me.[ControlName] = "..." Then
[ControlName].Visible = True
Else
[ControlName].Visible = False
End If

I'd also check out your tables to see if those "nuances" require multiple
tables, or additional fields are the right design. In general, a table
describes an entity and fields describe attributes of that entity. So, for
instance both customers and suppliers can both go in the same table (they
are companies or people) but require a few fields to describe their
differences.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Hello!

Two questions with connection:

I have many Forms because there are litle "nuances"
between they, as a result of different tables, with
differents fields.

1 - Are there some procedure (?) to optimize this, to
force only one "mask" Form read different tables, please?

2 - If the previous question is possible, is don't
possible in each form, to show or not, the fields which
don't exist in each table/record, with

If [Field] = "..." Then
[Field].Visible = True

?
Any help is welcome.
Thanks in advance.

an


.
 
Thanks for your opinion
an
-----Original Message-----
You can reset a form's Recordsource in code. However, you can run into
problems if you've got controls on the form that are bound to fields that
don't actually exist in the recordset. Toggling the control's visibility
isn't really sufficient: you should also change the field's control source
(to make it unbound).

In your form's Open event, you can have code like:

Select Case WhatForm
Case 1
Me.RecordSource = "qryABC"
Me.txtField1.ControlSource = "City"
Me.txtField1.Visible = True
Case 2
Me.RecordSource = "qryDEF"
Me.txtField1.ControlSource = vbNullString
Me.txtField1.Visible = False
End Select

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Hello!

Two questions with connection:

I have many Forms because there are litle "nuances"
between they, as a result of different tables, with
differents fields.

1 - Are there some procedure (?) to optimize this, to
force only one "mask" Form read different tables, please?

2 - If the previous question is possible, is don't
possible in each form, to show or not, the fields which
don't exist in each table/record, with

If [Field] = "..." Then
[Field].Visible = True

?
Any help is welcome.
Thanks in advance.

an


.
 
#1 - This is what I have. One form to each table. From
where... many identical forms.

Well... it sounds like you have many identical (or nearly identical)
TABLES, if you need many identical forms.

Multiple tables with the same structure is probably a flaw in your
table design. How do these tables differ? Are the for multiple
subclasses of a single Entity? If so, you may want to consider using a
single table with one additional field to classify the data.

John W. Vinson[MVP]
(no longer chatting for now)
 
Thanks for your reply.

The situation is the next:

F_1, unbound, with 5 tab controls.
Tab control11 for SubF_11 based in T_11;
Tab control12 for SubF_12 based in T_12; up to
Tab control15 for SubF_15 based in T_15;

F_2, unbound, with 3 tab controls.
Tabcontrol21 for SubF_21 based in T_21;
Tabcontrol22 for SubF_22 based in T_22;
Tabcontrol23 for SubF_23 based in T_23;
.. . .
F_9 with anothers tabcontrols for anothers SubF_ . . .

The similarity between tables is because there are
differents filds between them.

My question is;
Possibility, or not, to have only one together (Form and
SubForm) to load determined table, according our necessity.

The fields which don't exist in each Table and SubForm:

If [Field] = "..." Then
[Field].Visible = True

Thanks in advance.

an
 
Possibility, or not, to have only one together (Form and
SubForm) to load determined table, according our necessity.

It's possible; what you could do is change the Recordsource of the
form at the time you determine which table should be displayed. You
can in addition use the form's Load event to toggle the visibility of
controls on the form.

Performance and stability might be better, though, if you had multiple
forms. Rather than opening a form and changing its Recordsource, you
could dynamically change the SourceObject property of the subform to
the appropriate Form.

I'm still queasy about your database design, but I'll leave that
discussion for another time!

John W. Vinson[MVP]
(no longer chatting for now)
 
Thanks.
All the best.
an
-----Original Message-----
necessity.

It's possible; what you could do is change the Recordsource of the
form at the time you determine which table should be displayed. You
can in addition use the form's Load event to toggle the visibility of
controls on the form.

Performance and stability might be better, though, if you had multiple
forms. Rather than opening a form and changing its Recordsource, you
could dynamically change the SourceObject property of the subform to
the appropriate Form.

I'm still queasy about your database design, but I'll leave that
discussion for another time!

John W. Vinson[MVP]
(no longer chatting for now)
.
 
Back
Top