473,836 Members | 2,012 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
(frmBookingBook ingBased), 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 btnDefaultConfe renceEntry_Clic k()
' 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.

frmBookingBooki ngBased.SetFocu s ' move to subform
DoCmd.GoToRecor d , , acNewRec ' make a new
record
frmBookingBooki ngBased!Expecte dIn = Startdate ' set startdate
frmBookingBooki ngBased!Expecte dOut = Enddate ' set enddate
frmBookingBooki ngBased!Comment = Comment ' set comment
frmBookingBooki ngBased!RoomID. SetFocus ' leave ready for
room
End Sub
Thanks all.

Max.
Nov 12 '05 #1
1 3063
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 btnDefaultConfe renceEntry_Clic k()
' 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 ![subformcontroln ame].Form.SetFocus> >

frmBookingBooki ngBased.SetFocu s ' move to subform
DoCmd.GoToRecor d , , acNewRec ' make a new
record
frmBookingBooki ngBased!Expecte dIn = Startdate ' set startdate
frmBookingBooki ngBased!Expecte dOut = Enddate ' set enddate
frmBookingBooki ngBased!Comment = Comment ' set comment
frmBookingBooki ngBased!RoomID. SetFocus ' leave ready for
room
End Sub

Mike Storr
www.veraccess.com

"Max Harvey" <go****@DELTAL. org> wrote in message
news:7a******** *************** ***@posting.goo gle.com...
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
(frmBookingBook ingBased), 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 btnDefaultConfe renceEntry_Clic k()
' 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.

frmBookingBooki ngBased.SetFocu s ' move to subform
DoCmd.GoToRecor d , , acNewRec ' make a new
record
frmBookingBooki ngBased!Expecte dIn = Startdate ' set startdate
frmBookingBooki ngBased!Expecte dOut = Enddate ' set enddate
frmBookingBooki ngBased!Comment = Comment ' set comment
frmBookingBooki ngBased!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
1591
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 NIGO_ITEM, you'll notice a subform to the NIGO_REASONS table. It won't let any data be entered into this subform and it gives the error: You cannot add or change a record because a related record is required in table CUSTOMER_TABLE. (Error 3201) This...
2
1757
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 ApplicationID. And Application has ApplicationID as its primary key. With the main Form being the Student_Details form, I have a Button which loads the Application Form. The way I want it to behave is when the Load_AppForm button is clicked the...
0
1461
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 ApplicationID. And Application has ApplicationID as its primary key. With the main Form being the Student_Details form, I have a Button which loads the Application Form. The way I want it to behave is when the Load_AppForm button is clicked the...
3
2808
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 already has linked data in the subform. This totally defeats the purpose of my search, which is to find an existing customer's details in order to enter new data in the subform. I was wondering if there is a way, in the form/subform situation,...
5
3656
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 (SubForm of SubForm C)
9
2751
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 selected in the main form. I thought all I had to do for the subform was create a query and set the criteria equal to the option group value in the main form. No way, Jose! When the form/subform opens, the option group value is not available to the...
0
1136
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 subForm in parent.MdiChildren){ if(subForm.Name == theForm.Name){ subForm.Hide(); subForm.Show();
10
3629
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 subform is close to completion, but I still need help... The parent form's recordset has fields string integer COLORNAME CLASSSIZE and a few more that aren't relevant here.
5
1857
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 fldTransTotal where the control source is =Sum(). LineTotal is derived from Quantity * Amount in the above query. I have a checkbox called chkActive on frmCust that I want to allow the operators to uncheck only if the balance of the customer is...
1
3612
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 a combo box with a Select query to select one of the records in Table A. (The parent form is bound to Table A.) I want to be able to first, view all of the corresponding records from Table B and then second, give an option for editing these...
0
9812
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10824
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10533
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10579
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7775
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5813
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4443
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 we have to send another system
2
4003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3103
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.