473,386 Members | 1,786 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,386 software developers and data experts.

Problem updating record from subform if it contains only prefilled values

Hi - (This is my very first post)
I have gotten to this point of registering to post because I have been
spinning my wheels so long, I believe I am all caught up in the weeds.
(and mud)

I have a form, that has several tabs. On one tab, I have a subform
(wr_completion_subform). This subform is bound to a table
(wr_completion_table).
On the subform, I have a button from which I have added code to email
a report of the completion data to our wr completion mailbox.
(wr=work request).
I also prefill many of the controls with information from the other
tabs.

If the user clicks on any of the controls in the subform, the table is
updated.
However, if the user accepts all the prefilled info and clicks the
'email' button, a blank report generates (no record on table to
report).

I saw a very similar post from 10/01 where the developer was advised
to use the me.dirty = false and the me.refresh. I have tried this and
other methods I have stumbled upon in the usenet group. Nothing seems
to work.

The table is bound to the subform, but I still added sql to check for
the record existance and if not there, SQL to insert else SQL to
update. I thought a manual insert or update would get around it - it
does not.

One clue: I read somewhere where the record selector will turn to a
pencil if it needs to be updated and will be an arrow if nothing to
update. I turned the record selector on in my subform and noticed it
was an arrow before submitting the report and a pencil after
submitting the report. (was not dirty until sometime AFTER the button
was clicked).

Please - If anyone has any wisdom, I would greatly appreciate it. I
need to be rolling out the product next week. (3/03/04)
Thank you in advance.
Nov 12 '05 #1
5 2414
Maybe it's a cheat, but what if your command button clicks one of the
checkboxes (at random, doesn't matter) *twice*? That does not change the
entry, but does set the record dirty.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #2
"Mary Litten" <ma*********@alldata.net> wrote in message
news:83**************************@posting.google.c om...
Hi - (This is my very first post)
I have gotten to this point of registering to post because I have been
spinning my wheels so long, I believe I am all caught up in the weeds.
(and mud)

I have a form, that has several tabs. On one tab, I have a subform
(wr_completion_subform). This subform is bound to a table
(wr_completion_table).
On the subform, I have a button from which I have added code to email
a report of the completion data to our wr completion mailbox.
(wr=work request).
I also prefill many of the controls with information from the other
tabs.

If the user clicks on any of the controls in the subform, the table is
updated.
However, if the user accepts all the prefilled info and clicks the
'email' button, a blank report generates (no record on table to
report).

I saw a very similar post from 10/01 where the developer was advised
to use the me.dirty = false and the me.refresh. I have tried this and
other methods I have stumbled upon in the usenet group. Nothing seems
to work.

The table is bound to the subform, but I still added sql to check for
the record existance and if not there, SQL to insert else SQL to
update. I thought a manual insert or update would get around it - it
does not.

One clue: I read somewhere where the record selector will turn to a
pencil if it needs to be updated and will be an arrow if nothing to
update. I turned the record selector on in my subform and noticed it
was an arrow before submitting the report and a pencil after
submitting the report. (was not dirty until sometime AFTER the button
was clicked).

Please - If anyone has any wisdom, I would greatly appreciate it. I
need to be rolling out the product next week. (3/03/04)
Thank you in advance.


At first glance, it look sto me as if you do not actually create a record in
the subform and that is why it the report is blank. Imagine you did
everything as you described (simply pressing the button and 'accepting the
defaults') but with the AllowAdditions property of the subform turned off.
Now what happens?
Was there some event, some code which creates the related record? Or do you
find that no record is created? If I am on the right track here, then
perhaps you need to ask yourself:
Should one (or more) related records be automatically created without user
intervention?
What event should trigger the creation of the related record(s)?

Fletcher
Nov 12 '05 #3
thanx for the quick response.
I don't have any check boxes, but I appended a space to one of the
fields - and it worked.

stProjName = Forms![* Project
Communication]![WR_Completion_Subform].Form![Project Name] & " "
Forms![* Project
Communication]![WR_Completion_Subform].Form![Project Name] = stProjName

I'd like to figure out how to do it without cheating, though. The
screen kinda winks/blinks at me because of the 'cheat'. Like it knows
what I am up to :)!

However - I this will at least let me hit my deadline. Hopefully I can
get a better understanding later and remove the 'cheat'.

thanx again!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #4
Thanx for the feedback, Fletcher. I have included your questions and my
responses below. If you have a suggestion for a solution, let me know.

with the AllowAdditions property of the subform turned off.
Now what happens?
-> The subform does not display. I'm not sure what this shows me??

Was there some event, some code which creates the related record? Or do
you
find that no record is created?
-> The form is bound to the table. This should cause the data to be
prepared for insert into the table, but the insert is not committed to
the table until you leave the form.
Should one (or more) related records be automatically created without
user intervention?
-> In this case, Yes. They review the information on the screen before
sending the report and have the opportunity to change it. If the report
has not been sent, no harm has been done.

What event should trigger the creation of the related record(s)?
-> The button that submits the report should create the record. However,
once again, it does not save the data until the user leaves the form.
(the button alone does not fire any of the events). I have tried code
in a variety of places to no avail.

I would like to find out HOW to commit the updates before the report is
created - and/or WHERE to put the update (dirty) logic.
FYI - if the record has been previously created and the user returns to
the form and updates the data, followed by submitting the report, the
updates ARE reflected. So, I finally got that logic to work. The
difference here is that the user has to click on a control on the form
to fire the update.
Knowledge (like life) is a journey, not a destination.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #5
"Mary" <an*******@devdex.com> wrote in message
news:40*********************@news.frii.net...
Thanx for the feedback, Fletcher. I have included your questions and my
responses below. If you have a suggestion for a solution, let me know.

with the AllowAdditions property of the subform turned off.
Now what happens?
-> The subform does not display. I'm not sure what this shows me??

Was there some event, some code which creates the related record? Or do
you
find that no record is created?
-> The form is bound to the table. This should cause the data to be
prepared for insert into the table, but the insert is not committed to
the table until you leave the form.
Should one (or more) related records be automatically created without
user intervention?
-> In this case, Yes. They review the information on the screen before
sending the report and have the opportunity to change it. If the report
has not been sent, no harm has been done.

What event should trigger the creation of the related record(s)?
-> The button that submits the report should create the record. However,
once again, it does not save the data until the user leaves the form.
(the button alone does not fire any of the events). I have tried code
in a variety of places to no avail.

I would like to find out HOW to commit the updates before the report is
created - and/or WHERE to put the update (dirty) logic.
FYI - if the record has been previously created and the user returns to
the form and updates the data, followed by submitting the report, the
updates ARE reflected. So, I finally got that logic to work. The
difference here is that the user has to click on a control on the form
to fire the update.

Hi Mary,
Now it seems very clear what is happening - if the user does not use the
subform, then no record ever gets created.

Here is one possible solution:

On your main form set AllowAdditions to false.
Create a new button on the form which says New... and performs the following
actions:

1. Creates and saves a new main record
2. Creates and saves a related record
3. Requeries the main form
4. Goes to the newly created main record

Would you be able to write the code for this?

One question I still have is this:
If one (and only one?) related record needs to be created automatically in
the subform, then are you sure the 2 records don't belong in the same table,
or can you have more related records but a minimum of one?

I don't know what the table structure is like, but in a typical database you
might have tblOrders and tblOrderItems and you might have a button saying
"New Order". When you press it, it creates asks you what you want to order,
then creates a new order with today's date, etc and a single new order item.
It then takes you to the order record where you could add more items. The
point is that it automatically creates the first one since an order with no
items might make no sense. Is your a similar scenario?
Fletcher
Nov 12 '05 #6

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

Similar topics

3
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...
2
by: Lyn | last post by:
Hi, I am working on a genealogy project in which I have two tables: Person -- one record for each person in the family. Each record has a unique Autonum field (IDPerson). Partnerships -- one...
4
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...
4
by: Laura | last post by:
Here's the situation: I'm trying to use an update query to copy data from one row to another. Here is the situation: I have 5 companies that are linked to each other. I need to show all 5...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
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...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
1
geolemon
by: geolemon | last post by:
I have a form/subform used for inventory management. It is a bound form. The error: I don't understand what this means. How the form is intended to work: When you select a part number in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.