473,388 Members | 1,256 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Automatic updating record from VBA with data not displayed on a form

I have a subform with multiple records tied to a main record and main
form. In the subform I create and update the subform records. However,
there are other pieces of data, statistics, I want to add automatically
to the record when it is saved. I can access the data via VBA code in a
"before update" event. Any way to address the record itself and all
fields - even fields not on the form?

So far I figure I could
1) put all the statistics fields on the subform layout, hidden and
protected, all bunched on top of each other (15 fields). Might make
debugging difficult.

2) Instead use the after update event. Get the record key, an
autonumbered field, after the update and use VBA code to read the
dynaset and update the record.

Other suggestions?

Bob Alston
Nov 13 '05 #1
4 2051
Bob Alston wrote:
I have a subform with multiple records tied to a main record and main
form. In the subform I create and update the subform records. However,
there are other pieces of data, statistics, I want to add automatically
to the record when it is saved. I can access the data via VBA code in a
"before update" event. Any way to address the record itself and all
fields - even fields not on the form?

So far I figure I could
1) put all the statistics fields on the subform layout, hidden and
protected, all bunched on top of each other (15 fields). Might make
debugging difficult.

2) Instead use the after update event. Get the record key, an
autonumbered field, after the update and use VBA code to read the
dynaset and update the record.

Other suggestions?

Bob Alston

It appears that using the Recordsetclone capability is what I need. But
how to get the bookmark of the record being updated or just updated?

Bob
Nov 13 '05 #2
Bob Alston wrote:
Bob Alston wrote:
I have a subform with multiple records tied to a main record and main
form. In the subform I create and update the subform records.
However, there are other pieces of data, statistics, I want to add
automatically to the record when it is saved. I can access the data
via VBA code in a "before update" event. Any way to address the
record itself and all fields - even fields not on the form?

So far I figure I could
1) put all the statistics fields on the subform layout, hidden and
protected, all bunched on top of each other (15 fields). Might make
debugging difficult.

2) Instead use the after update event. Get the record key, an
autonumbered field, after the update and use VBA code to read the
dynaset and update the record.

Other suggestions?

Bob Alston


It appears that using the Recordsetclone capability is what I need. But
how to get the bookmark of the record being updated or just updated?

Bob

More - I think I am close. Not sure if the bookmark property for "me"
is valid????

With Me.RecordsetClone

..Bookmark = Me.Bookmark
..Edit
..Fields("stat01") = 111

..Update
End With

Bob Alston
Nov 13 '05 #3
Bob

The data doesn't need to actually be on the form, only in the form's
underlying recordsource.

Neil

Bob Alston <tu****************@cox.net> wrote in message news:<g2Qqd.61547$_g6.16902@okepread03>...
Bob Alston wrote:
I have a subform with multiple records tied to a main record and main
form. In the subform I create and update the subform records. However,
there are other pieces of data, statistics, I want to add automatically
to the record when it is saved. I can access the data via VBA code in a
"before update" event. Any way to address the record itself and all
fields - even fields not on the form?

So far I figure I could
1) put all the statistics fields on the subform layout, hidden and
protected, all bunched on top of each other (15 fields). Might make
debugging difficult.

2) Instead use the after update event. Get the record key, an
autonumbered field, after the update and use VBA code to read the
dynaset and update the record.

Other suggestions?

Bob Alston

It appears that using the Recordsetclone capability is what I need. But
how to get the bookmark of the record being updated or just updated?

Bob

Nov 13 '05 #4
NeilAnderson wrote:
Bob

The data doesn't need to actually be on the form, only in the form's
underlying recordsource.


Which reminds me to add that this is not the case for reports. (or is it?)

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #5

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
3
by: Steven Stewart | last post by:
Hi there, I have posted about this before, but yet to arrive at a solution. I am going to try to explain this better. I have an Employees table and a Datarecords table (one-to-many...
1
by: nic | last post by:
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...
5
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to...
2
by: Jon S via DotNetMonster.com | last post by:
Hi all I'm new to C# and ADO.Net. I've managed to insert, update and delete records from a database but I need to know how to show these changes immediately. For example : If I delete a record...
1
by: Spock | last post by:
Hi. I have a form with a listbox and a few label fields all bound to a dataset. When i navigate the listbox the labels change accordingly. so far everything works good. I made a button to...
1
by: rdemyan via AccessMonster.com | last post by:
My App has 10 or so tables that we provide that contains proprietary data. This data will need to be updated once or twice a year. I would like some comments, suggestions on my proposed strategy...
2
by: underground | last post by:
Hi, everyone I've been trying to figure out a way for a user to update there information. I'm using sections to identify the specific user..Here is the form <? include("include/session.php");...
4
by: aaronyoung | last post by:
I have created custom navigation buttons and Record Number indicators on several forms that are used to review and update records based on a query. My On Current event to update the "Record X of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
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
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...

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.