473,508 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing a form to a subform (VB problems)

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
1 3038
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1571
by: Josh C. | last post by:
Hello everyone. I'm a bit of an Access newbie, so please bear with me. Please go to http://www.dumoti.com/access/ to view the database - 536kb. I'll go straight into examples: In the form...
2
1746
by: nic | last post by:
Hi I am currently having problems getting two forms to behave the way I want. I have two tables Student and Application, and their respective forms. (Tables)Student has StudentID (PK) & an...
0
1448
by: nic | last post by:
Hi I am currently having problems getting two forms to behave the way I want. I have two tables Student and Application, and their respective forms. (Tables)Student has StudentID (PK) & an...
3
2790
by: Simone | last post by:
Hi All, I have a Find Record button setup in most of my forms in order to find a specific customer's details. I have just noticed today though that this search will only find the customer if it...
5
3644
by: ego | last post by:
Hi all , I had created the following Form/SubForm structure : MainForm SubForm A (SubForm of MainForm) SubForm B (SubForm of SubForm A) SubForm C (SubForm of SubForm B) SubForm D ...
9
2731
by: PC Datasheet | last post by:
I'm stuck on something that seems should be easy and I need some help. My main form has an option group with five options. My subform chooses from different lists depending on which option is...
0
1121
by: pei_world | last post by:
Hi, the problem describes as below: 1st question //============== code =================== //= in Parent Form, I create following function: void newForm(Form parent,Form theForm){ foreach(Form...
10
3597
by: Thelma Lubkin | last post by:
My form/subform combination that allows user to display 'ColorSet' records, move to other records via a selector, to add,delete, and edit them, and to manage the related 'Color' records from the...
5
1843
by: Ron | last post by:
Hi All, I've got a form called frmCust that has a subform on it called sfrmBalance. sfrmBalance's control source is a query called qryTrans4CustBal. sfrmBalance has one field on it called...
1
3579
by: troy_lee | last post by:
I have a table (Table A). It has one field, a PK. It is in a 1:M with another table (Table B). I am having trouble with a form/subform setup to view the 1:M records. On the parent form, there is...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.