How to cause another Form to show?

  • Thread starter Thread starter nws
  • Start date Start date
N

nws

How do I programatically cause another form to load?

Is the code something like this...?

Form.Load ("Form2")
 
Try this:

docmd.OpenForm "Form2", acNormal

For more info, search Access Visual Basic Help on "OpenForm".

-Michael
 
Thanks Michael!


Michael H said:
Try this:

docmd.OpenForm "Form2", acNormal

For more info, search Access Visual Basic Help on "OpenForm".

-Michael
 
Thanks that helped.

How how do I cause that same form to only show the record
of a certain ID?

For example, sometimes I would want it to open with
record ID=3 and sometimes with record ID=5
and others?
 
Try this...

docmd.openform "form2", acnormal, , "ID = 5"

For the "ID = 5" you can enter your own value for each time, or you can use
a field on an open form. For example, if you had a form with a field intID
and you wanted it to be used as the ID in the new form try....

docmd.openform "form2", acnormal, , "ID = " & [intID]

Let me know if this doesn't make sense.

Joey Archer
MVP wantabee :o)
 
Is there a way to do something like this....?

docmd.openform "form2", acnormal, , ID = CurrentRecord





Joey Archer said:
Try this...

docmd.openform "form2", acnormal, , "ID = 5"

For the "ID = 5" you can enter your own value for each time, or you can
use
a field on an open form. For example, if you had a form with a field
intID
and you wanted it to be used as the ID in the new form try....

docmd.openform "form2", acnormal, , "ID = " & [intID]

Let me know if this doesn't make sense.

Joey Archer
MVP wantabee :o)

nws said:
Thanks that helped.

How how do I cause that same form to only show the record
of a certain ID?

For example, sometimes I would want it to open with
record ID=3 and sometimes with record ID=5
and others?
 
That depends on what CurrentRecord is. If it is a field on another form, you
should be able to do something like this (watch for line wrap):
DoCmd.OpenForm "form2", acNormal, , "ID = " & Forms("FormName").CurrentRecord

If it is a variable:
DoCmd.OpenForm "form2", acNormal, , "ID = " & CurrentRecord

-Michael

nws said:
Is there a way to do something like this....?

docmd.openform "form2", acnormal, , ID = CurrentRecord





Joey Archer said:
Try this...

docmd.openform "form2", acnormal, , "ID = 5"

For the "ID = 5" you can enter your own value for each time, or you can
use
a field on an open form. For example, if you had a form with a field
intID
and you wanted it to be used as the ID in the new form try....

docmd.openform "form2", acnormal, , "ID = " & [intID]

Let me know if this doesn't make sense.

Joey Archer
MVP wantabee :o)

nws said:
Thanks that helped.

How how do I cause that same form to only show the record
of a certain ID?

For example, sometimes I would want it to open with
record ID=3 and sometimes with record ID=5
and others?




Try this:

docmd.OpenForm "Form2", acNormal

For more info, search Access Visual Basic Help on "OpenForm".

-Michael


:

How do I programatically cause another form to load?

Is the code something like this...?

Form.Load ("Form2")
 
Yeah you can. Try doing this...

docmd.openform "form2", acnormal, , "ID = " & form_formname.IDField

That should pull the ID field from the current record and use it on the
filter on "form2"

"formname" is the name of the form that you are taking the ID field from to
apply it to the new form's filter when it opens. It starts with... "form_"
then you type in the name of the form. Make sense?

Joey Archer
Young Padawan Learner

nws said:
Is there a way to do something like this....?

docmd.openform "form2", acnormal, , ID = CurrentRecord





Joey Archer said:
Try this...

docmd.openform "form2", acnormal, , "ID = 5"

For the "ID = 5" you can enter your own value for each time, or you can
use
a field on an open form. For example, if you had a form with a field
intID
and you wanted it to be used as the ID in the new form try....

docmd.openform "form2", acnormal, , "ID = " & [intID]

Let me know if this doesn't make sense.

Joey Archer
MVP wantabee :o)

nws said:
Thanks that helped.

How how do I cause that same form to only show the record
of a certain ID?

For example, sometimes I would want it to open with
record ID=3 and sometimes with record ID=5
and others?




Try this:

docmd.OpenForm "Form2", acNormal

For more info, search Access Visual Basic Help on "OpenForm".

-Michael


:

How do I programatically cause another form to load?

Is the code something like this...?

Form.Load ("Form2")
 
nws said:
Is there a way to do something like this....?

docmd.openform "form2", acnormal, , ID = CurrentRecord





Joey Archer said:
Try this...

docmd.openform "form2", acnormal, , "ID = 5"

For the "ID = 5" you can enter your own value for each time, or you can
use
a field on an open form. For example, if you had a form with a field
intID
and you wanted it to be used as the ID in the new form try....

docmd.openform "form2", acnormal, , "ID = " & [intID]

Let me know if this doesn't make sense.

Joey Archer
MVP wantabee :o)

nws said:
Thanks that helped.

How how do I cause that same form to only show the record
of a certain ID?

For example, sometimes I would want it to open with
record ID=3 and sometimes with record ID=5
and others?




Try this:

docmd.OpenForm "Form2", acNormal

For more info, search Access Visual Basic Help on "OpenForm".

-Michael


:

How do I programatically cause another form to load?

Is the code something like this...?

Form.Load ("Form2")
 

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

Back
Top