Open Form

R

rml

I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
K

Klatuu

In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
 
R

rml

Tried it but still the same.

Golfinray said:
Try putting the end if before the docmd.openform

rml said:
I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
R

rml

No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

Klatuu said:
In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


rml said:
I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
K

Klatuu

I thought you wanted the form you are opening to stay the way you designed it.
--
Dave Hargis, Microsoft Access MVP


rml said:
No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

Klatuu said:
In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


rml said:
I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
R

rml

I do. I want both to stay.

Klatuu said:
I thought you wanted the form you are opening to stay the way you designed it.
--
Dave Hargis, Microsoft Access MVP


rml said:
No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

Klatuu said:
In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


:

I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
K

Klatuu

To stay what?
Can you describe this in a little more detail, please? Or is it working now?
--
Dave Hargis, Microsoft Access MVP


rml said:
I do. I want both to stay.

Klatuu said:
I thought you wanted the form you are opening to stay the way you designed it.
--
Dave Hargis, Microsoft Access MVP


rml said:
No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

:

In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


:

I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
R

rml

I have form A and on that form I have a command button. When you click the
button it opens form B with the record you were on in form A. Form A has
onload Maximize. When you click the button and form B opens, it is maximized
and does not seem to take the properties I have set on it. Modal, etc...

If I open the form B by itself, it works fine.

Does that make more sense?

Thanks.

Klatuu said:
To stay what?
Can you describe this in a little more detail, please? Or is it working now?
--
Dave Hargis, Microsoft Access MVP


rml said:
I do. I want both to stay.

Klatuu said:
I thought you wanted the form you are opening to stay the way you designed it.
--
Dave Hargis, Microsoft Access MVP


:

No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

:

In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


:

I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
K

Klatuu

That is what I posted earlier.
Docmd.Restore will return form B to its saved size.
How are you determining it is not Modal?
--
Dave Hargis, Microsoft Access MVP


rml said:
I have form A and on that form I have a command button. When you click the
button it opens form B with the record you were on in form A. Form A has
onload Maximize. When you click the button and form B opens, it is maximized
and does not seem to take the properties I have set on it. Modal, etc...

If I open the form B by itself, it works fine.

Does that make more sense?

Thanks.

Klatuu said:
To stay what?
Can you describe this in a little more detail, please? Or is it working now?
--
Dave Hargis, Microsoft Access MVP


rml said:
I do. I want both to stay.

:

I thought you wanted the form you are opening to stay the way you designed it.
--
Dave Hargis, Microsoft Access MVP


:

No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

:

In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


:

I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
K

Klatuu

NP
I only need my glasses when I want to see <g>
Or is it you just washed your hands and you can't do a thing with them?
 
R

rml

Ok, that kind of works. It does restore form B to its original state but it
makes form A be not maximized. Also, I have form B set as Modal but it lets
you go to form A. If I open form B up by itself, it keeps all the property
settings but when it is opened through form A, it seems to behave very
different.

Any more suggestions?

Thanks.

Klatuu said:
That is what I posted earlier.
Docmd.Restore will return form B to its saved size.
How are you determining it is not Modal?
--
Dave Hargis, Microsoft Access MVP


rml said:
I have form A and on that form I have a command button. When you click the
button it opens form B with the record you were on in form A. Form A has
onload Maximize. When you click the button and form B opens, it is maximized
and does not seem to take the properties I have set on it. Modal, etc...

If I open the form B by itself, it works fine.

Does that make more sense?

Thanks.

Klatuu said:
To stay what?
Can you describe this in a little more detail, please? Or is it working now?
--
Dave Hargis, Microsoft Access MVP


:

I do. I want both to stay.

:

I thought you wanted the form you are opening to stay the way you designed it.
--
Dave Hargis, Microsoft Access MVP


:

No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

:

In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


:

I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
K

Klatuu

As I said in my first post, form A will change size.
Try opening the form using the acDialog option. That way, you can't go
anywhere from it.
--
Dave Hargis, Microsoft Access MVP


rml said:
Ok, that kind of works. It does restore form B to its original state but it
makes form A be not maximized. Also, I have form B set as Modal but it lets
you go to form A. If I open form B up by itself, it keeps all the property
settings but when it is opened through form A, it seems to behave very
different.

Any more suggestions?

Thanks.

Klatuu said:
That is what I posted earlier.
Docmd.Restore will return form B to its saved size.
How are you determining it is not Modal?
--
Dave Hargis, Microsoft Access MVP


rml said:
I have form A and on that form I have a command button. When you click the
button it opens form B with the record you were on in form A. Form A has
onload Maximize. When you click the button and form B opens, it is maximized
and does not seem to take the properties I have set on it. Modal, etc...

If I open the form B by itself, it works fine.

Does that make more sense?

Thanks.

:

To stay what?
Can you describe this in a little more detail, please? Or is it working now?
--
Dave Hargis, Microsoft Access MVP


:

I do. I want both to stay.

:

I thought you wanted the form you are opening to stay the way you designed it.
--
Dave Hargis, Microsoft Access MVP


:

No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

:

In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


:

I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
R

rml

Sorry but what do you mean by acDialog option? Can you explain how?

Thanks.

Klatuu said:
As I said in my first post, form A will change size.
Try opening the form using the acDialog option. That way, you can't go
anywhere from it.
--
Dave Hargis, Microsoft Access MVP


rml said:
Ok, that kind of works. It does restore form B to its original state but it
makes form A be not maximized. Also, I have form B set as Modal but it lets
you go to form A. If I open form B up by itself, it keeps all the property
settings but when it is opened through form A, it seems to behave very
different.

Any more suggestions?

Thanks.

Klatuu said:
That is what I posted earlier.
Docmd.Restore will return form B to its saved size.
How are you determining it is not Modal?
--
Dave Hargis, Microsoft Access MVP


:

I have form A and on that form I have a command button. When you click the
button it opens form B with the record you were on in form A. Form A has
onload Maximize. When you click the button and form B opens, it is maximized
and does not seem to take the properties I have set on it. Modal, etc...

If I open the form B by itself, it works fine.

Does that make more sense?

Thanks.

:

To stay what?
Can you describe this in a little more detail, please? Or is it working now?
--
Dave Hargis, Microsoft Access MVP


:

I do. I want both to stay.

:

I thought you wanted the form you are opening to stay the way you designed it.
--
Dave Hargis, Microsoft Access MVP


:

No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

:

In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


:

I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
K

Klatuu

It is the 5th argument of the OpenForm method.
It sets the Modal and Popup properties to Yes.
Look in VBA Help for details.
--
Dave Hargis, Microsoft Access MVP


rml said:
Sorry but what do you mean by acDialog option? Can you explain how?

Thanks.

Klatuu said:
As I said in my first post, form A will change size.
Try opening the form using the acDialog option. That way, you can't go
anywhere from it.
--
Dave Hargis, Microsoft Access MVP


rml said:
Ok, that kind of works. It does restore form B to its original state but it
makes form A be not maximized. Also, I have form B set as Modal but it lets
you go to form A. If I open form B up by itself, it keeps all the property
settings but when it is opened through form A, it seems to behave very
different.

Any more suggestions?

Thanks.

:

That is what I posted earlier.
Docmd.Restore will return form B to its saved size.
How are you determining it is not Modal?
--
Dave Hargis, Microsoft Access MVP


:

I have form A and on that form I have a command button. When you click the
button it opens form B with the record you were on in form A. Form A has
onload Maximize. When you click the button and form B opens, it is maximized
and does not seem to take the properties I have set on it. Modal, etc...

If I open the form B by itself, it works fine.

Does that make more sense?

Thanks.

:

To stay what?
Can you describe this in a little more detail, please? Or is it working now?
--
Dave Hargis, Microsoft Access MVP


:

I do. I want both to stay.

:

I thought you wanted the form you are opening to stay the way you designed it.
--
Dave Hargis, Microsoft Access MVP


:

No, Docmd.Maximize
As for the form vs report. Yes, I know but I'm using some code that shows a
photo and need some command buttons as well so a form works better in this
case for me.

I still need to figure out why this is happening.

Thanks.

:

In the load event of the form you are opening

Docmd.Restore

That will cause it to take on the shap and position it was when you last
saved the form. It will also cause the other form to reduce it size, however.

Can you tell me why you are using a form to print a record? Why not use a
report? Reports are designed for printing, forms are not.
--
Dave Hargis, Microsoft Access MVP


:

I have a form that onload, I have it set to maximize. On that form, I have a
command button that opens another form with that record. See code below.
The problems is that when I click the button, the second form also maximizes
and does not seem to take the properties I have set on it. IE: modal, pop
up, etc...

Why is this happening?

Thanks.

Private Sub Command384_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[auto] = " & Me.[auto]

DoCmd.OpenForm "QC Form", acViewPreview, , strWhere
End If
End Sub
 
R

Rick Brandt

rml said:
Ok, that kind of works. It does restore form B to its original state
but it makes form A be not maximized. Also, I have form B set as
Modal but it lets you go to form A. If I open form B up by itself,
it keeps all the property settings but when it is opened through form
A, it seems to behave very different.

Any more suggestions?

In Access if you maximize one thing you maximize all things. The exception
to this are forms and reports opened as popups. Are you quite sure you set
the modal AND the PopUp property on form B to Yes? Modal won't help with
the size issue, but PopUp should.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top