473,692 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save button in Main Form and save it on to Subform and on the Table

3 New Member
Hello Sir, Im here again asking for help. I have a form and a subform relate to HVAC Windward Table. i have a SAVE button on the form that when clicked it saves data on the HVAC Windward Table but not in a subform. When manually inputing data into subform it saves by work order on the HVAC Windward Table in subdatasheet even if how many times i add data in one work order. Sir, Is it posible that when i clicked on the SAVE button in the form it saves the current data both on the HVAC Windward Table and to the subform as in same data in one work order, coz if the work order is "reschedule d" when i clicked SAVE button it will goes to subform and to the table and if re-entry the same work order is completed it will goes again in the subform and to the table, now there are two record in one work order in subform and to the HVAC Windward Table. Is there any code for this? Im using wizard to create SAVE command button and here's the code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Save_Record_Click()
  2. On Error GoTo Err_Save_Record_Click
  3.  
  4. DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  5.  
  6. Exit_Save_Record_Click:
  7. Exit Sub
  8.  
  9. Err_Save_Record_Click:
  10. MsgBox Err.Description
  11. Resume Exit_Save_Record_Click
  12.  
  13. End Sub
Any help would be appreciated..th anks and god bless!
Dec 18 '07 #1
1 6113
PianoMan64
374 Recognized Expert Contributor
OK, first thing is, that you don't need a save record button on the main form. When the focus of the form changes to the subform the main form record saves automaticly.

One thing that I need to make sure that is setup correctly is the relationship between the main and sub forms.

if you get into the properties of the sub form and make sure the following fields are filled out.

Link Child Field
Link Master Field

These two fields are what links the main form to the sub form so the relationship between the information on the main form and the sub form are sync'd

then when you enter information on the sub form, and long as you go to an new records before you close, then that should autosave the subform records without the need for save or update buttons on the form.

I hope that helps,

Joe P.
Jan 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3335
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a main form with a continuous subform. On the main form I have a text field called . It gets populated based on what the user selects in a field on the sub form (code in the AfterUpdate Event). Here's the issue. If the user deletes a subform record. The field on the main form shows null even if there is a value in the preceding subform record. What I'd like it to do is immediately refresh to
2
3847
by: Colin | last post by:
I have a main form with a command button on it that when clicked, opens a subform displaying records that relate to the main form. I would like to disable the command button if the corresponding subform does not contain a record. I'm guessing this action would take place in the OnClick event of the command button but I'm not sure what the VB code is for checking if a record exists. Any coding examples and suggestions would be very...
4
7013
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
2
15714
by: dskillingstad | last post by:
I'm trying to assign a custom value to a textbox. Here's what I have. I've created a module and "default value" code for a textbox which generates a custom auto-number (yyyy-0000) when a New Record button is clicked. The code checks the table for the highest value and then assigns 1 and inserts the value. I have a second text box which needs the same type of custom auto-number which has to be generated from a second command button. ...
2
5206
by: emc_cos | last post by:
I have a very nice parent child relationship happening between a main form and 8 subforms. The main form is the data entry point for a table that holds textual data like names, notes and the like. It also holds the primary key which is an alpha-numeric file designation. The subforms are the data entry point for another table that holds numeric values for time spent on tasks.
3
1986
by: kevin.vaughan | last post by:
Hello Everybody and Everymind, I am using Access 2003 on an XP network. The code below activates from a command button on a form. It selects data from a table and then displays it in a cell on the subform. It doesn't however save it to the subforms' recordsource. Other cells in the subform don't have this trouble. Does anyone know what I could do to make Access save the information to the recordsource? Regards
4
2532
by: freeskier | last post by:
Hello, I am creating a form for data entry. The main form has personal (address, phone) information that is allready stored. the subform has blank fields for information that is being entered. The fields on the subform are stored in a different table than the personal information on the main form. Each form is bound to the corresponding table. I use the code created by the wizard for the save button. something like: Private Sub...
51
15291
AccessIdiot
by: AccessIdiot | last post by:
Hi there, I would like to put a button on my form that enables or unlocks the subform and at the same time disables (locks) the main form until the user is done with the subform. At that point the user would click a button on the subform that returns to the main form and re-disables the subform. In other words, enter data on the main form, click the button to go to the sub form. Main form "locks" (becomes disabled), now the user can enter...
4
2982
by: Whasigga | last post by:
Hi I've created a form that has 7 subforms. It is the same subform, bound to a table, just repeated. This form represents a week, and each subform is used to enter in data for each day of the week. The main form has a combo box that must have a value selected before anything else can happen. Once that value is selected, the 7 subforms are enabled, and also one of the fields is populated with the value from the main form. These subforms also...
0
8608
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
8963
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...
0
8806
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5820
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4324
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4557
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2974
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
2241
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.