By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,820 Members | 856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,820 IT Pros & Developers. It's quick & easy.

changing a form to a subform (VB problems)

P: n/a
Hi,

I made up a nice little form which had its own sub form in it.

I made a litle VB code so that when I pressed a button it would move
form the form (frmConference) to the subform
(frmBookingBookingBased), start a new record, and copy some values
form the form into some fields in the subform, and then leave the
cursor sitting (in focus) at the begining of the subform.

I will list the VB code below.

The problem I am now having, and of which I don't have enough
experiene to work out by myself yet, is now I decided I actually want
to put the form (with its subform) into a another form (not linked to
it) inside a tab, so one of the tabs on this new form (frmMainForm)
will be my form I made up (frmConference).

The problem is that whenever I try that, and I press the button,
instead of geting a new record in the subform like I used to
(populated with the data I copied), instead I get a new record in the
form itself (frmConference).

So... can anybody help me work out how to convert my code from being a
form/subform code bit to a form/tabed subform/subform code bit?
Code in quesiton quoted below.

Private Sub btnDefaultConferenceEntry_Click()
' The point of this button is to make a new entry which copies the
' start and end date into the expected fields of a new record. It
also
' copies the conference's comments into the comment field.

frmBookingBookingBased.SetFocus ' move to subform
DoCmd.GoToRecord , , acNewRec ' make a new
record
frmBookingBookingBased!ExpectedIn = Startdate ' set startdate
frmBookingBookingBased!ExpectedOut = Enddate ' set enddate
frmBookingBookingBased!Comment = Comment ' set comment
frmBookingBookingBased!RoomID.SetFocus ' leave ready for
room
End Sub
Thanks all.

Max.
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
This is a little tough for me to visualize, but maybe this will work. It can
be awkward sometimes when nesting forms and reports.
(new lines in << >>)

Private Sub btnDefaultConferenceEntry_Click()
' The point of this button is to make a new entry which copies the
' start and end date into the expected fields of a new record. It
also
' copies the conference's comments into the comment field.

<<frmMainForm![subformcontrolname].Form.SetFocus>>

frmBookingBookingBased.SetFocus ' move to subform
DoCmd.GoToRecord , , acNewRec ' make a new
record
frmBookingBookingBased!ExpectedIn = Startdate ' set startdate
frmBookingBookingBased!ExpectedOut = Enddate ' set enddate
frmBookingBookingBased!Comment = Comment ' set comment
frmBookingBookingBased!RoomID.SetFocus ' leave ready for
room
End Sub

Mike Storr
www.veraccess.com

"Max Harvey" <go****@DELTAL.org> wrote in message
news:7a**************************@posting.google.c om...
Hi,

I made up a nice little form which had its own sub form in it.

I made a litle VB code so that when I pressed a button it would move
form the form (frmConference) to the subform
(frmBookingBookingBased), start a new record, and copy some values
form the form into some fields in the subform, and then leave the
cursor sitting (in focus) at the begining of the subform.

I will list the VB code below.

The problem I am now having, and of which I don't have enough
experiene to work out by myself yet, is now I decided I actually want
to put the form (with its subform) into a another form (not linked to
it) inside a tab, so one of the tabs on this new form (frmMainForm)
will be my form I made up (frmConference).

The problem is that whenever I try that, and I press the button,
instead of geting a new record in the subform like I used to
(populated with the data I copied), instead I get a new record in the
form itself (frmConference).

So... can anybody help me work out how to convert my code from being a
form/subform code bit to a form/tabed subform/subform code bit?
Code in quesiton quoted below.

Private Sub btnDefaultConferenceEntry_Click()
' The point of this button is to make a new entry which copies the
' start and end date into the expected fields of a new record. It
also
' copies the conference's comments into the comment field.

frmBookingBookingBased.SetFocus ' move to subform
DoCmd.GoToRecord , , acNewRec ' make a new
record
frmBookingBookingBased!ExpectedIn = Startdate ' set startdate
frmBookingBookingBased!ExpectedOut = Enddate ' set enddate
frmBookingBookingBased!Comment = Comment ' set comment
frmBookingBookingBased!RoomID.SetFocus ' leave ready for
room
End Sub
Thanks all.

Max.

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.