Normal Topic Program crashing on subforms (Read 1178 times)
Justin_ICC
Junior Member
**
Offline



Posts: 95
Joined: Feb 5th, 2004
Program crashing on subforms
Feb 11th, 2004 at 2:03pm
Print Post Print Post  
In my database I have a parent form which is a clients information and a subform (in table form) which contains all the notes on a file.  It links the two forms relationaly by the client #. I have been trying to add programming to the subform to have it automatically enter the client # a note ID # and the date, time and user into the note line and then the user can enter their note on the file.

I found that every time I entered certain fields it occasionaly crashed and the programming never really worked. To try and resolve this I commented out all the code and just had it perform a writeln on each subform event just so i could see the path the program takes when navigating through subforms in case there was a problem with the logic. I then tested the code by pulling up the subform as a form and it seemed to be working there.

The next step was to try and pull up the parent form and try it again. When it first pulled up the parent form it reported that the subform and performed the form entry and element entry events (which in my opinion doesn't make sense about the element entry event as I hadn't clicked on the subform yet). I then clicked into the subform and noticed no events were executed (which is what I want to happen). Sometimes clicking into the subform crashes it some times it doesn't. I did find that if I clicked on an element twice while in the subform it crashed every time.

Anyone have any ideas? At this point I'm not even trying to do anything just have it write a msg on each event and it still keeps crashing  Cry.

Thanks

Justin
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Program crashing on subforms
Reply #1 - Feb 11th, 2004 at 3:22pm
Print Post Print Post  
Justin,

I do not understand and I do not have the ability to answer why it is crashing, However I find numerous anomalies with subform and programming. I believe many of the issues will be eliminated in the next fix.

I personally have moved on to work with some other parts of my application until the next fix is released. It gets to overwhelming and becomes unproductive to try and figure if it is a problem with the program or something I am doing.

In my case anyway there is plenty of other stuff for me to be learning.  Smiley
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Program crashing on subforms
Reply #2 - Feb 11th, 2004 at 3:35pm
Print Post Print Post  
Quote:
When it first pulled up the parent form it reported that the subform and performed the form entry and element entry events (which in my opinion doesn't make sense about the element entry event as I hadn't clicked on the subform yet).
Justin


I believe since you are relationally linked to the record in the subform as soon as a parent record is displayed the data that matches the link is searched and displayed on subform so actually it does enter (click on) the subform.

I found this to be a problem with using code to stop an f10 from adding blank record after blank record . I was able to use the code on the parent to control this but once I added same code to child databases every time it asked for the parent it then asked a similar question for each additional child subform.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Justin_ICC
Junior Member
**
Offline



Posts: 95
Joined: Feb 5th, 2004
Re: Program crashing on subforms
Reply #3 - Feb 11th, 2004 at 3:43pm
Print Post Print Post  
Bobscott, The form entry I could understand but not the element entry event. But I think i'll probably just work on another part of the database for now... unfortunately the note lines is the most important (and probably hardest part) of the database to develop properly.
  
Back to top
 
IP Logged
 
FSGROUP
Full Member
***
Offline


No personal text

Posts: 179
Location: Edmonton, Alberta, Canada
Joined: Jan 14th, 2004
Re: Program crashing on subforms
Reply #4 - Feb 11th, 2004 at 4:41pm
Print Post Print Post  
I've received crashes when executing code from a subform too, even w/ simple writelns.  I discovered that the code w/in a subform executed before the code in the parent form, so some of my accesses to variables caused the crash(or so i'm led to believe).  What are you trying to do in the subform? Have you been able to auto-enter the client#?
  
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Program crashing on subforms
Reply #5 - Feb 11th, 2004 at 4:59pm
Print Post Print Post  
Quote:
Have you been able to auto-enter the client#?


I believe what you are trying to achieve has been explained nicely by Bharat in an earlier post at this link Smiley

http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Justin_ICC
Junior Member
**
Offline



Posts: 95
Joined: Feb 5th, 2004
Re: Program crashing on subforms
Reply #6 - Feb 11th, 2004 at 5:11pm
Print Post Print Post  
Sometimes the automatic entry worked most of the time it did absolutely nothing - sometimes it crashed.

That code it wrote works well for retrieving the client number unfortunately it doesn't explain how to have it automatically fill out the records in the subform which is where I am having the problem.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Program crashing on subforms
Reply #7 - Feb 11th, 2004 at 6:46pm
Print Post Print Post  
Justin,

I am surprised you are having trouble with Bharats code. Iam using the code described and it works perfectly every time. The only problem I find is using it with table subforms but that is a Known bug with the subform.

Maybe we missed something in implementing it into your application.


This  code: 

Take the PatientID automatically from the mainform to subform and assign it PatientID in Subform.

(change patientid to your element name.)

First In the mainform, in patientid on Form entry event, please put the following code

if @update then
     {

           Globalvalue ("PatientID", patientID)
           writeln (@globalvalue ("patientID") + " is new Globalvalue")

     }


next In the mainform, in patientID on Element Exit event, please put the following code

if @Isnew then
     {

           Globalvalue ("patientID", PatientID)
           writeln (@globalvalue ("PatientID") + " is new Globalvalue")

     }


You may remove writeln line after you are confident that the code is working.

=========
This part returns the patientid to the subform record

Now in the database that the subform is created from. Using on form entry put the following code in patientid element

patientID = @globalvalue ("patientID")


Hope this helps a little, Keep us posted. Eventually we will all figure it out. Hang in there  Smiley
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Justin_ICC
Junior Member
**
Offline



Posts: 95
Joined: Feb 5th, 2004
Re: Program crashing on subforms
Reply #8 - Feb 11th, 2004 at 7:12pm
Print Post Print Post  
That code is working perfectly fine its everything else about the subform isn't working Sad
  
Back to top
 
IP Logged