You would place the code in the on click event of the command button. Have
you gotten this to work?
--
Please remember to mark this post as answered if this solves your problem.
"Steve" wrote:
> I'm missing something - if the values in the field that controls what
form
> should open are A,B,C,D and E for example - would I name the forms
A,B,C,D
> and E so they match per your example?
>
> Also, I'm not sure where I would place this code - could you please
> elaborate?
>
> THX!
> "Ryan" <Ryan@[EMAIL PROTECTED]
> wrote in message
> news:349195B2-95A4-4D60-BEFD-191850A336B4@[EMAIL PROTECTED]
> > This should work for you
> >
> > Private Sub YourCommandButtonName_Click()
> > Dim FormToOpen as String
> > FormToOpen = Me.TheNameOfTheField
> >
> > DoCmd.OpenForm "FormToOpen"
> > DoCmd.Close acForm, "ThisFormsName" (Optional)
> > End Sub
> >
> > To Return you would have a button on the other form and you could hard
> > code
> > the name of the form you came from into that code.
> >
> > Private Sub YourCommandButtonName_Click()
> >
> > DoCmd.OpenForm "YourOriginalFormName"
> > DoCmd.Close acForm, "ThisFormsName" (Optional)
> > End Sub
> > --
> > Please remember to mark this post as answered if this solves your
problem.
> >
> >
> > "Steve" wrote:
> >
> >> I want to add a command button to an existing form to allow entry of
> >> additional data for another table or tables via form. Can I control
what
> >> form is opened when they press the command button based on the value
of a
> >> field in the already open form? Do I need to do anything special
after
> >> opening the second form via command button to return bo the original
> >> form?
> >>
> >> Thx!
> >>
> >>
> >>
>
>
>


|