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

Data access page. Can not update sub form until main record saved.

374 256MB
This is something which is really bugging me, I can see why it happens but not how to fix it.


Basically I have a data acces page with a main form.

This main form then contains a sub form within a group section. I have the subform autoset to expand so it looks just the same as the rest of the form after some design changes.

The main form basically looks as follows:

Expand|Select|Wrap|Line Numbers
  1. Caption - tblLog
  2.  
  3. header - tblLog
  4.  
  5. header - tblCosts
  6. navigation - tblCosts
  7.  
  8. footer - tblLog
  9. navigation -tblLog
As you can see this allows me to be able to view/navigate tblCosts associated with tblLog.

This works fine for records that currently exist.

However when I add a new record I produce a unique ID number for tblLog (main part) correctly. However, tblCosts subform will not expand and remains hidden.

In order for me to display the subForm (or atleast a button to allow an addition to it) I have to save the main record.

I assume this is so within my database I fully create the relationship between my main table and my sub table. When I save the ID number from the main table links to the sub and costs can then be added.


I am a bit stuck because I am basically creating a submission form for non conformances and their associated costs. This will be hosted on an intranet allowing users to submit their information.

What I am worried about happening is that when users partially fill out the form if I create an event which uses some form of OnDirty etc to save the main form to allow sub form submission I could end up with partial data or masses of rows within my main table where users began to fill out a form and then left the page when they decided not to bother.

So all in all,

How could I get my subform to display? I don't understand how when I create a new record the ID number assigns correctly to the main form, (I can even close the window and it doesn't save the record, it only saves when I click submit) but the subform does not expand ready for datacapture, eventhough there is a direct link.


Thanks for any help.
Jun 24 '10 #1

✓ answered by munkee

@munkee
Well I have solved this one!


Firstly in order to ensure the cost subform displays the record has to be saved on loading the window. I have just finished the code and here it is:

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT language=vbscript event=onload for=window>
  2. <!--
  3.  
  4.  
  5. Call hi
  6.  
  7. -->
  8. </SCRIPT>
  9.  
  10. <SCRIPT language=vbscript>
  11.  
  12. Sub hi()
  13. msgbox "hi"
  14. MSODSC.CurrentSection.DataPage.NewRecord
  15. msgbox "hi"
  16. MSODSC.CurrentSection.DataPage.Save
  17. end sub
  18.  
  19. </SCRIPT>
The msgbox bits are there as code stops as I need to sort some timers to ensure they execute on time.

For everyone looking to display a new record everytime the page loads and do not want to use the DataEntry mode the code above will work for that.

Now the hard part which I am yet to finish coding but I think i can now is, what to do if a user decides to just close the form? I have already saved the record so I need a way to ensure that I do not end up with loads of crap data in my database.

So, I created a hidden checkbox. This checkbox is linked to my submit button. When the user clicks the submit button it puts a tick in the checkbox, saves the record + confirms saving.

However, if there is no tick in the checkbox i.e. no user has clicked submit, upon closing the window on the window unload event i do a record delete. This removes the half filled out record.

1 2223
munkee
374 256MB
@munkee
Well I have solved this one!


Firstly in order to ensure the cost subform displays the record has to be saved on loading the window. I have just finished the code and here it is:

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT language=vbscript event=onload for=window>
  2. <!--
  3.  
  4.  
  5. Call hi
  6.  
  7. -->
  8. </SCRIPT>
  9.  
  10. <SCRIPT language=vbscript>
  11.  
  12. Sub hi()
  13. msgbox "hi"
  14. MSODSC.CurrentSection.DataPage.NewRecord
  15. msgbox "hi"
  16. MSODSC.CurrentSection.DataPage.Save
  17. end sub
  18.  
  19. </SCRIPT>
The msgbox bits are there as code stops as I need to sort some timers to ensure they execute on time.

For everyone looking to display a new record everytime the page loads and do not want to use the DataEntry mode the code above will work for that.

Now the hard part which I am yet to finish coding but I think i can now is, what to do if a user decides to just close the form? I have already saved the record so I need a way to ensure that I do not end up with loads of crap data in my database.

So, I created a hidden checkbox. This checkbox is linked to my submit button. When the user clicks the submit button it puts a tick in the checkbox, saves the record + confirms saving.

However, if there is no tick in the checkbox i.e. no user has clicked submit, upon closing the window on the window unload event i do a record delete. This removes the half filled out record.
Jun 25 '10 #2

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

Similar topics

0
by: Irwinsp | last post by:
Hi All, I have a form that needs to be placed on the web. The form contains a subform. The relationship from the form to the sub-form is 1 to many. Can this type of form be converted to a Data...
0
by: Irwinsp | last post by:
Hi All, I have a form that needs to be placed on the web. The form contains a subform. The relationship from the form to the sub-form is 1 to many. Can this type of form be converted to a Data...
2
by: MX1 | last post by:
Does anyone know if you can convert a form into a data access page? It looks like you can only convert tables and I have a form with some very complex calculations that I'd love to leverage via an...
1
by: WindAndWaves | last post by:
Hi Everyone This post will probably create a whole new newsgroup....(or I may be referred to one - e.g. rec.dummies) I was wondering if anyone can tell me the answer to a number of related...
0
by: Manystrengths | last post by:
I must warn all of you willing to help me that this is my first go at designing a functional data access page. Please bear in mind that we all start somewhere so if I should be asking the absolute...
0
by: Spencer Lee | last post by:
I have encountered a very unique problem (for me): I created a data access page, with 3 levels of groups. I put the file on the web folder (intranet), and it seems like everything is working...
1
by: mirajsen | last post by:
Hello, I am trying to enter records to a table through a Data Access page, which is linked to the table. When I open the page, it is showing the first record which is in the table. Is there...
1
by: Boozehound | last post by:
Hi, I've created a data access page for staff to verify their permissions on one of our systems. A section of the page has a list of permissions and whether it is currently available to them...
3
by: JP Romano | last post by:
Hi - I'm putting together a status report summary for a team of about 15 based in the US (various places), London, Hong Kong, etc. The users have expressed interest in using a web form (data access...
6
by: munkee | last post by:
Is there a way to automatically have a web based data access page to start on a new record when you open the page? (Without going to data entry mode in page properties) If I go to data entry mode,...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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.