Can Command Button cycle between open forms?

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

Guest

I would like to know if a command button can be created to cycle from one
open form to another? If so, how?
 
You didn't say what it was you wanted to do with the forms, so this is just
by way of example ...

Private Sub Command0_Click()

Dim frm As Form

For Each frm In Forms
If frm.Section(0).BackColor = vbRed Then
frm.Section(0).BackColor = vbBlue
Else
frm.Section(0).BackColor = vbRed
End If
Next frm

End Sub
 
Brendan Reynolds said:
You didn't say what it was you wanted to do with the forms, so this is just
by way of example ...

Private Sub Command0_Click()

Dim frm As Form

For Each frm In Forms
If frm.Section(0).BackColor = vbRed Then
frm.Section(0).BackColor = vbBlue
Else
frm.Section(0).BackColor = vbRed
End If
Next frm

End Sub

Brendan, Thanks, for the response, I don't know as of yet how to make it or
see if it solves my problem.

I sent my question without enclosing all the necessary information. Sorry
about that! I was seeking to find a way to use a command button on a form
that was orginally activated by a primary command button on the subform part
of a mainsubform to recall the orginal mainsubform. I was trying to find a
way to avoid using either the 'ctrl+F6' or the windows status bar button.

I used a macro "OpenForm" command to open form [Subject(Input)], which is
another form for my subform supported table, ContactSubject, with the "Where"
condition,
[ContactNM]=[Forms]![ConSubMainFormInput1]![ConSubSubFormInput1].[Form]![ContactNM].
This form opens with a recordset of 1, but can be used to add more record
information as well as add new records. However, when I tried to use a
command button on Subject(Input) after being opened by the
ConSubMainFormInput1 command button, the where condition I used
[ContactID]=[Forms]![ConSub(Input)]![contactID] will reopen the form,
ConSubMainFormInput1, however, it now reopens with a recordset of 1, in other
words, none of the records in the supported table, ContactsID are available.
As you may have noticed I am using the ContactID field in Subject(Input) as a
field in my Where condition to reopen ConSubMainFormInput1. I am not even
trying to get into the sub part of the mainsubform. I would like to know how
to do that as well.

In general, I am seeking to find out if a command button/OpenForm macro can
open a form that can inact with all the records in the supported table. My
problem exists both, when I used the mainsubform to open another form and
when I try to reopen the mainsubform from that mainsubform opened form.

If the solution requires a macro like you described, please include the
property sheet and control information I will need. Thx.

Acchow
 
I'm sorry, I'm afraid I was unable to follow your description of the
problem.

--
Brendan Reynolds
Access MVP

acchow said:
Brendan Reynolds said:
You didn't say what it was you wanted to do with the forms, so this is
just
by way of example ...

Private Sub Command0_Click()

Dim frm As Form

For Each frm In Forms
If frm.Section(0).BackColor = vbRed Then
frm.Section(0).BackColor = vbBlue
Else
frm.Section(0).BackColor = vbRed
End If
Next frm

End Sub

Brendan, Thanks, for the response, I don't know as of yet how to make it
or
see if it solves my problem.

I sent my question without enclosing all the necessary information. Sorry
about that! I was seeking to find a way to use a command button on a form
that was orginally activated by a primary command button on the subform
part
of a mainsubform to recall the orginal mainsubform. I was trying to find
a
way to avoid using either the 'ctrl+F6' or the windows status bar button.

I used a macro "OpenForm" command to open form [Subject(Input)], which is
another form for my subform supported table, ContactSubject, with the
"Where"
condition,
[ContactNM]=[Forms]![ConSubMainFormInput1]![ConSubSubFormInput1].[Form]![ContactNM].
This form opens with a recordset of 1, but can be used to add more record
information as well as add new records. However, when I tried to use a
command button on Subject(Input) after being opened by the
ConSubMainFormInput1 command button, the where condition I used
[ContactID]=[Forms]![ConSub(Input)]![contactID] will reopen the form,
ConSubMainFormInput1, however, it now reopens with a recordset of 1, in
other
words, none of the records in the supported table, ContactsID are
available.
As you may have noticed I am using the ContactID field in Subject(Input)
as a
field in my Where condition to reopen ConSubMainFormInput1. I am not even
trying to get into the sub part of the mainsubform. I would like to know
how
to do that as well.

In general, I am seeking to find out if a command button/OpenForm macro
can
open a form that can inact with all the records in the supported table.
My
problem exists both, when I used the mainsubform to open another form and
when I try to reopen the mainsubform from that mainsubform opened form.

If the solution requires a macro like you described, please include the
property sheet and control information I will need. Thx.

Acchow
 
Brendan, thanks for giving it another look. I will have to continue to
explore how to easily miminck 'Ctrl+F6' at the form level to cycle from one
form to another without getting a recordset of 1(filtered) as a response on
the recalled form. I haven't been able to quite figure out how to make your
initial recommendation work. Thx, Acchow.

Brendan Reynolds said:
I'm sorry, I'm afraid I was unable to follow your description of the
problem.

--
Brendan Reynolds
Access MVP

acchow said:
Brendan Reynolds said:
You didn't say what it was you wanted to do with the forms, so this is
just
by way of example ...

Private Sub Command0_Click()

Dim frm As Form

For Each frm In Forms
If frm.Section(0).BackColor = vbRed Then
frm.Section(0).BackColor = vbBlue
Else
frm.Section(0).BackColor = vbRed
End If
Next frm

End Sub

--
Brendan Reynolds
Access MVP

I would like to know if a command button can be created to cycle from
one
open form to another? If so, how?

Brendan, Thanks, for the response, I don't know as of yet how to make it
or
see if it solves my problem.

I sent my question without enclosing all the necessary information. Sorry
about that! I was seeking to find a way to use a command button on a form
that was orginally activated by a primary command button on the subform
part
of a mainsubform to recall the orginal mainsubform. I was trying to find
a
way to avoid using either the 'ctrl+F6' or the windows status bar button.

I used a macro "OpenForm" command to open form [Subject(Input)], which is
another form for my subform supported table, ContactSubject, with the
"Where"
condition,
[ContactNM]=[Forms]![ConSubMainFormInput1]![ConSubSubFormInput1].[Form]![ContactNM].
This form opens with a recordset of 1, but can be used to add more record
information as well as add new records. However, when I tried to use a
command button on Subject(Input) after being opened by the
ConSubMainFormInput1 command button, the where condition I used
[ContactID]=[Forms]![ConSub(Input)]![contactID] will reopen the form,
ConSubMainFormInput1, however, it now reopens with a recordset of 1, in
other
words, none of the records in the supported table, ContactsID are
available.
As you may have noticed I am using the ContactID field in Subject(Input)
as a
field in my Where condition to reopen ConSubMainFormInput1. I am not even
trying to get into the sub part of the mainsubform. I would like to know
how
to do that as well.

In general, I am seeking to find out if a command button/OpenForm macro
can
open a form that can inact with all the records in the supported table.
My
problem exists both, when I used the mainsubform to open another form and
when I try to reopen the mainsubform from that mainsubform opened form.

If the solution requires a macro like you described, please include the
property sheet and control information I will need. Thx.

Acchow
 
Back
Top