473,809 Members | 2,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating Form Data to Table on Event Procedure

nic
Hi

I have two forms form1 and form2. I am trying to get all the data
entered in form1 to be updated to the table on an event. ie. when I
click the button to load form2, I need the data from form1 to exist in
the table for relationship reasons. form2 works fine if the records
displayed in form1 already exist in the table, ie form1 was closed
then re-opened or moving between records will also write the data to
the table. But if I have created a new record in form1 and then load
form2, any data is lost when the form is close as form1 data hasn't
been written to the table.

I would like for the data to be coded into the procedure that opens
form2. Also I am passing OpenArgs to form2.

Any suggestions.
Nov 12 '05 #1
1 3779
You can write VBA code to do that; the overall plan is to create a
string which is a SQL Insert query, then
DoCmd.RunSQL strSQLInsertQue ry

However,
A much easier approach (sually) is to use a statement (this version is
from Access 2000):
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
This saves the current record. Just run the code before opening form2!

If you allow the user to open form2 only from a button on form1, then
this should work just fine, added to the button's click event.

Access will build that code if you turn on the Access Control Wizards,
create a button, and when the Wizard opens, specify Record Operations -
Save Record.

Bruce Pick
+++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++++++ ++
To send mail, remove all < > and [ ] and the junk ~ between:
[brucepick1]
< a~t >
[comcast.net]

nic wrote:
Hi

I have two forms form1 and form2. I am trying to get all the data
entered in form1 to be updated to the table on an event. ie. when I
click the button to load form2, I need the data from form1 to exist in
the table for relationship reasons. form2 works fine if the records
displayed in form1 already exist in the table, ie form1 was closed
then re-opened or moving between records will also write the data to
the table. But if I have created a new record in form1 and then load
form2, any data is lost when the form is close as form1 data hasn't
been written to the table.

I would like for the data to be coded into the procedure that opens
form2. Also I am passing OpenArgs to form2.

Any suggestions.

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2487
by: Ryan.Chowdhury | last post by:
This is a general question regarding the use of view and stored procedures. I'm fairly new to databases and SQL. I've created a SQL database using an Access Data Project ("ADP") and I'm satified with the table structure. I've moved on to building some front ends for our users. I'm running into situations where I want subreports to be built from queries that are dependent on the values in other controls. I've played with stored...
1
2586
by: Old Timer | last post by:
I wish to type in a number in my "Code" field, for instance 1060, I then wish the number 1060 to trigger an event that will fill in the next field (township field) For instance, 1060 brings up and fills in name "Spencer Tp". I have 30 townships,2 cities, 6 villages and identifiers consisting 38 separate code numbers assigned by our county government to identify each township,city and village. I ran a "Make Table Query", have created a...
3
1422
by: Andy | last post by:
Hi, New to Access... so please be kind. Have designed a form which ithe user may wish to update the data in future (name/address/tel info) I would like to put a button on the page so the user can update the "edit date" if they wish. How can I do this so that hitting a button updates the "edit date" with the current date?
10
5689
by: jaYPee | last post by:
does anyone experienced slowness when updating a dataset using AcceptChanges? when calling this code it takes many seconds to update the database SqlDataAdapter1.Update(DsStudentCourse1) DsStudentCourse1.AcceptChanges() i'm also wondering because w/ out AcceptChanges the data is still save into the database and it is now faster.
6
2611
by: kaosyeti | last post by:
hey.... i have a duplicate record issue i could use some help with. on a form that has 2 unbound controls, txtboxyear and cboxmonth, together will automatically fill in an invisible txtboxdate that is bound to a table and has no duplicates allowed. the problem is that there are 30 or so other controls here to be filled in and if the user selects a year and month that already has a record created, she/he won't know it until access tries to...
3
2072
by: cyber0ne | last post by:
I'm designing a basic form for data entry into one main table. There are two fields in the table that I would like to be automatically populated, not user-entered, when the record is posted. One is the current system time as a Date/Time value, the other is the current system username as a Text value. Being _completely_ new to MS Access, how/where do I set the form to do this when it posts a record? Also, can I distinguish between an...
6
3686
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
2
3324
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the CurrentChanged event of the BindingSource of the combobox to update the textbox. When selecting an item in the combobox or when selecting a row in the grid, it is updating the textbox correctly. The problem is when I apply a filter in the grid, and then...
0
2516
by: Mike | last post by:
So here's the situation (.NET 2.0 btw): I have a form, and on this form is a textbox among many other databound controls. The textbox is bound to a field in a data table via the Text property. In this table there are multiple columns that cannot be NULL, which, are bound to other controls (but they're not really important at this time). I create a new row via the currency manager like so: _currencyManager.AddNew() _currentRow =...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10378
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,...
0
10115
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
9198
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
6881
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
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
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
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
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.