MS Access problem

MS Access problem

Postby Rick Lipkin » Thu Oct 13, 2011 5:03 pm

To All

I am putting together a major application with a MS Access backend .. I have a strange problem..

I have a xbrowse property table that when you double click .. the detail screen opens six tables which in turn I view thru panels ..

Where I am having problems is as I open and close the detail records from the master Property table ( about 10 times ) .. the related six tables fail to open always at the forth table. I have temporarily rem'd out the forth table and again after a few open and closes .. the forth table refuses to open...

The only way I can get the tables to re-open is to quit the Master Property table and re-open the Property table and once again the relational tables open.

Unfortunitly I do not know if this is a timing issue with Access or resource problem ? When I close the detail screen I am closing all the relational tables and I know they are all closing properly ..

Any Ideas would be appreciated !

Thanks
Rick Lipkin

Code: Select all  Expand view

//-------------------------------
FUNC _PropView( cMODE,oRsProp,oWnd,oBtn1,oBtn2,oBtn3,oBtn4,oBtn5,oBtn6,oBtn7,oBtn8,oBtn9,oBtn10,oBrw )

LOCAL SAYING,cDEFA
LOCAL cTITLE, lOK1
LOCAL oIco,oBrush

LOCAL oRsOwn,oERR,cSQL,cPROPEID,oRsDwell,oRsRes,oRsVeh,oRsPet,oRsBoat
LOCAL cEID

// will always be in view or edit


IF cMODE = "A"
   cMODE := "V"
ENDIF

IF oRsProp:EOF
   SAYING := "SORRY ... Before you can EDIT or View a record"+chr(10)
   SAYING += "You have to ADD one First"+chr(10)
   MsgInfo( SAYING )
   _CleanUP()
   RETURN(NIL)
ENDIF

IF xWRITE = 'Y' .or. xSUPER = 'Y'
ELSE
   SAYING := "You have READ ONLY Rights Here"
   MsgInfo( SAYING )
   cMODE := "V"
ENDIF

cDEFA := SET(7)
lOK   := .F.
lOK1  := .F.

// relational key

cPROPEID := oRsProp:Fields("propeid"):Value

// open Owner table

cSQL := "SELECT * from OWNER where PROPEID = '"+cPROPEID+"' order by CurrentOwner,LastName"

oRsOwn := TOleAuto():New( "ADODB.Recordset" )
oRsOwn:CursorType     := 1        // opendkeyset
oRsOwn:CursorLocation := 3        // local cache
oRsOwn:LockType       := 3        // lockoportunistic

TRY
   oRsOwn:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening OWNER table" )
   _CleanUP()
   RETURN(.F.)
END TRY

SysReFresh()

// open dwelling table

cSQL := "SELECT * from DWELLING where PROPEID = '"+cPROPEID+"'"

oRsDwell := TOleAuto():New( "ADODB.Recordset" )
oRsDwell:CursorType     := 1        // opendkeyset
oRsDwell:CursorLocation := 3        // local cache
oRsDwell:LockType       := 3        // lockoportunistic

TRY
   oRsDwell:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening DWELLING table" )
   oRsOwn:Close()
   _CleanUP()
   RETURN(.F.)
END TRY

SysReFresh()

// open resident table

cSQL := "SELECT * from RESIDENT where PROPEID = '"+cPROPEID+"' order by ResidentSort,LastName,FirstName"

oRsRes := TOleAuto():New( "ADODB.Recordset" )
oRsRes:CursorType     := 1        // opendkeyset
oRsRes:CursorLocation := 3        // local cache
oRsRes:LockType       := 3        // lockoportunistic

TRY
   oRsRes:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening RESIDENT table" )
   oRsOwn:Close()
   oRsDwell:Close()
   _CleanUP()
   RETURN(.F.)
END TRY

// open pets table .... dies here

cSQL := "SELECT * from PETS where PROPEID = '"+cPROPEID+"'"

oRsPet := TOleAuto():New( "ADODB.Recordset" )
oRsPet:CursorType     := 1        // opendkeyset
oRsPet:CursorLocation := 3        // local cache
oRsPet:LockType       := 3        // lockoportunistic

TRY
   oRsPet:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening PETS table" )
   oRsOwn:Close()
   oRsDwell:Close()
   oRsRes:CLose()
   _CleanUP()
   RETURN(.F.)
END TRY

// open vehicle table

cSQL := "SELECT * from VEHICLE where PROPEID = '"+cPROPEID+"'"

oRsVeh := TOleAuto():New( "ADODB.Recordset" )
oRsVeh:CursorType     := 1        // opendkeyset
oRsVeh:CursorLocation := 3        // local cache
oRsVeh:LockType       := 3        // lockoportunistic

TRY
   oRsVeh:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening VEHICLE table" )
   oRsOwn:Close()
   oRsDwell:Close()
   oRsRes:CLose()
   oRsVeh:CLose()
   _CleanUP()
   RETURN(.F.)
END TRY

// open boats table

cSQL := "SELECT * from BOATS where PROPEID = '"+cPROPEID+"'"

oRsBoat := TOleAuto():New( "ADODB.Recordset" )
oRsBoat:CursorType     := 1        // opendkeyset
oRsBoat:CursorLocation := 3        // local cache
oRsBoat:LockType       := 3        // lockoportunistic

TRY
   oRsBoat:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening VEHICLE table" )
   oRsOwn:Close()
   oRsDwell:Close()
   oRsRes:CLose()
   oRsVeh:CLose()
   oRsPet:Close()
   _CleanUP()
   RETURN(.F.)
END TRY
 


Image

Image
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: MS Access problem

Postby Armando » Thu Oct 13, 2011 5:39 pm

Rick:

I have a couple ideas, lets try the first one

Pls close the table before open it again.

Code: Select all  Expand view

IF oRsPet <> NIL
    IF oRsPet:State() = adStateOpen
        oRsPet:Close()
    ENDIF
ENDIF

cSQL := "SELECT * from PETS where PROPEID = '"+cPROPEID+"'"

oRsPet := TOleAuto():New( "ADODB.Recordset" )
oRsPet:CursorType     := 1        // opendkeyset
oRsPet:CursorLocation := 3        // local cache
oRsPet:LockType       := 3        // lockoportunistic

TRY
   oRsPet:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening PETS table" )
   oRsOwn:Close()
   oRsDwell:Close()
   oRsRes:CLose()
   _CleanUP()
   RETURN(.F.)
END TRY
 


Regards
Last edited by Armando on Thu Oct 13, 2011 6:41 pm, edited 1 time in total.
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3218
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: MS Access problem

Postby Rick Lipkin » Thu Oct 13, 2011 6:09 pm

Armando

Your suggestion made sense .. but it had no effect .. the magic number seems to be 7 opens and closes and then the 4th table or so refuses to open.

I have had timing issues with Access during the data conversion with multiple records being added and updated .. I had to put SysWait() in between the oRs:Update()s to keep the program from failing ..

I feel certain the tables are closed .. I just think the IO on the Access table is just too much and the .mdb just can not keep up ..

What looks promising ( so far ) is just opening up all the tables in the very beginning and using oRs:Filter conditions to give me my relational records... I would rather not do that, but this problem seems like a IO timing issue with Access.

Any other suggestions would be VERY welcome!

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: MS Access problem

Postby Armando » Thu Oct 13, 2011 6:37 pm

Rick: :oops:

Rick Lipkin wrote:What looks promising ( so far ) is just opening up all the tables in the very beginning and using oRs:Filter conditions to give me my relational records... I would rather not do that, but this problem seems like a IO timing issue with Access.
Rick Lipkin


That was my second one idea. in fact I do that way but with MySql, I have a PRG with ten tables and not problem at all.

Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3218
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: MS Access problem

Postby Bayron » Thu Oct 13, 2011 7:15 pm

It may not have anything to do with this, but do you have set properly the number of files that (x)Harbour can handle???

Code: Select all  Expand view
sethandlecount( 40 )
 


EDITED:
Also check this page:

http://www.geeksengine.com/article/how-to-change-timeout-value-for-access-sql.html
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: MS Access problem

Postby Rick Lipkin » Thu Oct 13, 2011 9:07 pm

Bayron

I appreciate your suggestion .. the queries are all ADO and just open tables passing the foreign key .. nothing very difficult.

So far the 'open all' tables using filter conditions seem to have stabilized the intermittent errors .. I hate to keep tables open and only open and close what I need .. when I need it. So often pc's lock up for various reasons and depending on how bad they crash .. so goes your tables be it .dbf or .mdb.

I would MUCH prefer Sql server .. however, this project will be for a small group of users on a peer to peer network..

Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: MS Access problem

Postby Rick Lipkin » Fri Oct 14, 2011 2:35 pm

Bayron

Thanks for your second suggestion .. setting the handle count had no effect .. It just seems there is a limit on how many times ( usually 10 opens and closes ) Access will allow .. Darnedest thing I have ever seen ..

I have built my whole program around Access and in the final testing .. you can only open and close 10 records that open multiple and close tables.

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: MS Access problem

Postby nageswaragunupudi » Fri Oct 14, 2011 2:50 pm

I have built my whole program around Access and in the final testing .. you can only open and close 10 records that open multiple and close tables.

Mr Rick
This is a surprising news to me also.

In that case,

#1. Can you try data shaping? Not sure how it works with Access though. But the main table and all linked tables are just one recordset with child chapters.

or

#2. You may not need to show all the child tables at the same time on the screen. You may keep opening and closing what child table you need to show on the screen.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: MS Access problem

Postby Rick Lipkin » Fri Oct 14, 2011 4:55 pm

Rao

I am working thru changes to this program to open all tables with the initial master Property xbrowse. When I click into the detail .. originally I opened up all the detail tables then the details screen would populate the panels and when a tab was selected .. the browses were all keyed up.

When the details screen closed all the detail tables would close and return control back to the Master Property table.

Then once again the open and close cycle would start when you clicked on the Property details .. open all the tables ... then close them down. On the 10th iteration of opening and closing .. the forth ( or so ) table would fail in the try\catch break point and return me to the master Property table. Close the master property table and reopen it .. would fix the problem til you cycled thru the same process 10 times.

When I go thru the valid close .. all the tables get closed and the object reference gets nil'd out .. so I do not see this as a memory leak.

I had to switch gears and open all the tables at once with the master Property table .. then use a filter condition to simulate the scoping of my foreign key on the related tables. So far that has worked just fine .. I have been able to cycle thru the master\detail as many times as I wish ..

However, now I am dealing with rewriting the concurrency and workstation visibility with stale buffered up recordsets. I did not have to deal with that because I was always opening up a fresh recordset with each time I looked at the detail.

Within the detail are xbrowses cued up with multiple residents, vehicles, etc .. and you can drill farther into the xbrowses to get to the individual data.

As it turns out you can not issue a ReQuery from the the action trigger pre or post because xbrowse was in focus and re-shuffling the deck with a fresh recordset causes xbrowse to break with all kinds of bookmark problems.

What I have done is when I drill to my individual data from xbrowse is issue the Requery from the form level save the primary key, do a oBrw:Refresh then find the row .. at that point I can reissue a oBrw:ReFresh and return back to xbrowse and the rows are repopulated ..

Here is the requery code when I go into the form .. which detects if that row was possibly deleted by another user or the data had changed

All this work is because Access does not respect the ReSync() method ..

Just thought I would share this code .. I think these ideas can help other ADO users deal with their concurrency and workstation visibility as well.

Rick Lipkin

Code: Select all  Expand view

//-------------------------------
FUNC _ResView( cMODE,oRsRes,oRsProp,oBrw )

LOCAL SAYING,cDEFA
LOCAL cTITLE, lOK1,oBTN1,oBTN2,oBTN3

cDEFA := SET(7)

IF cMODE = "E" .or. cMODE = "A"
   IF xSUPER = 'Y' .or. xWRITE = 'Y'
   ELSE
      SAYING := "You have READ ONLY Rights Here"
      MsgInfo( SAYING )
      cMODE := "V"
   ENDIF
ENDIF

IF oRsRes:EOF .and. cMODE <> "A"
   SAYING := "SORRY ... Before you can EDIT or VIEW a record"+chr(10)
   SAYING += "You have to ADD one First"+chr(10)
   MsgInfo( SAYING )
   _CleanUP()
   RETURN(.F.)
ENDIF

// test for concurrency
// and workstation updates
If cMode = "V" .or. cMode = "E"

   cEID  := oRsRes:Fields("ResidentEid"):Value
   cNAME := alltrim( oRsRes:Fields("FirstName"):Value)+" "+;
            alltrim( oRsRes:Fields("LastName"):Value)

   oRsRes:ReQuery()

   try
     oRsRes:MoveFirst()
   catch
     Saying := "Sorry .. there was a problem Accessing your record"+chr(10)
     Saying += "For Resident "+cNAME+CHR(10)
     Saying += "Check the transaction log to see if someone else"+chr(10)
     Saying += "Deleted your record before you did"+chr(10)
     MsgInfo( saying )
     oBrw:ReFresh()
     Return(.f.)
   End Try

   oRsRes:Find( "ResidentEid = '"+cEID+"'" )

   if oRsRes:eof
      Saying := "Sorry .. there was a problem Accessing your record"+chr(10)
      Saying += "For Resident "+cNAME+CHR(10)
      Saying += "Check the transaction log to see if someone else"+chr(10)
      Saying += "Deleted your record before you did"+chr(10)
      MsgInfo( saying )
      oRsRes:MoveFirst()
      oBrw:ReFresh()
      Return(.f.)
   Endif

   oBrw:ReFresh()

Endif

cDEFA := SET(7)
lOK   := .F.

IF cMODE = "A"

   cFirstName         := space(30)
   cMiddleInitial     := space(2)
   cLastName          := space(30)
   dDob               := ctod("")
   cResidentEmail     := space(50)
   cMaleFemale        := space(1)
   cPhoneType         := space(15)
   cAltPhone          := space(13)
   cResidentComments  := space(200)
   cResidentType      := "OWNER         "
   nRad_ResidentOrder := 1
   xUPDATED           := 1

ELSE

   cFirstName         := oRsRes:Fields("FirstName"):Value
   cMiddleInitial     := oRsRes:Fields("MiddleInitial"):Value
   cLastName          := oRsRes:Fields("LastName"):Value
   dDob               := if(empty(oRsRes:Fields("dob"):Value),ctod("00/00/0000"),oRsRes:Fields("dob"):Value )
   cResidentEmail     := oRsRes:Fields("ResidentEmail"):Value
   cMaleFemale        := oRsRes:Fields("MaleFemale"):Value
   cPhoneType         := oRsRes:Fields("PhoneType"):Value
   cAltPhone          := oRsRes:Fields("AltPhone"):Value
   cResidentComments  := oRsRes:Fields("ResidentComments"):Value
   cResidentType      := oRsRes:Fields("ResidentType"):Value
   nRad_ResidentOrder := oRsRes:Fields("ResidentOrder"):Value
   xUPDATED           := oRsRes:Fields("updated"):Value

ENDIF

 


Image

Image

Image
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: MS Access problem ( solved )

Postby Rick Lipkin » Sat Oct 15, 2011 4:27 pm

Rao and All

Playing with this code again last night .. I changed the location
of my table variable oRs objects to the top of my calling program as
static rather than local to the program where the tables are created.

Apparently the local oRs variables defined in the program eventually lost their scope.. and the program just 'breaks'.

That seems to have cured the problem.

Thanks for everyones help and advice !
Rick Lipkin

Code: Select all  Expand view

STATIC oYrbuilt,oModel,oBedrms,oCBXFire,oLastpaint,oPainter
STATIC oLastroof,oRoofcolor,oRoofmfr,oRoofer,oStrcomm,oPaintColor
STATIC cYrbuilt,cModel,cBedrms,lCBXFire,cLastpaint,cPainter
STATIC cLastroof,cRoofcolor,cRoofmfr,cRoofer,cStrcomm,cPaintColor
STATIC yUPDATED

STATIC oRsOwn,oRsRes,oRsPet,oRsVeh,oRsBoat,oRsDwell // moved here to static


#INCLUDE "FIVEWIN.CH"
#include "xbrowse.ch"

//-------------------------------
FUNC _PropView( cMODE,oRsProp,oWnd,oBtn1,oBtn2,oBtn3,oBtn4,oBtn5,oBtn6,oBtn7,oBtn8,oBtn9,oBtn10,oBrw )

LOCAL SAYING,cDEFA
LOCAL cTITLE, lOK1
LOCAL oIco,oBrush
LOCAL cPROPEID
LOCAL cEID

// moved these to top as static
* LOCAL oRsOwn,oERR,cSQL,cPROPEID,oRsDwell,oRsRes,oRsVeh,oRsPet,oRsBoat


// will always be in view or edit

IF cMODE = "A"
   cMODE := "V"
ENDIF

IF oRsProp:EOF
   SAYING := "SORRY ... Before you can EDIT or View a record"+chr(10)
   SAYING += "You have to ADD one First"+chr(10)
   MsgInfo( SAYING )
   _CleanUP()
   RETURN(NIL)
ENDIF

IF xWRITE = 'Y' .or. xSUPER = 'Y'
ELSE
   SAYING := "You have READ ONLY Rights Here"
   MsgInfo( SAYING )
   cMODE := "V"
ENDIF

cDEFA := SET(7)
lOK   := .F.
lOK1  := .F.

// relational key

cPROPEID := oRsProp:Fields("propeid"):Value

cSQL := "SELECT * from OWNER where PROPEID = '"+cPROPEID+"' order by CurrentOwner,LastName"

oRsOwn := TOleAuto():New( "ADODB.Recordset" )
oRsOwn:CursorType     := 1        // opendkeyset
oRsOwn:CursorLocation := 3        // local cache
oRsOwn:LockType       := 3        // lockoportunistic

TRY
   oRsOwn:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening OWNER table" )
   _CleanUP()
   RETURN(.F.)
END TRY

SysReFresh()

// open dwelling table

cSQL := "SELECT * from DWELLING where PROPEID = '"+cPROPEID+"'"

oRsDwell := TOleAuto():New( "ADODB.Recordset" )
oRsDwell:CursorType     := 1        // opendkeyset
oRsDwell:CursorLocation := 3        // local cache
oRsDwell:LockType       := 3        // lockoportunistic

TRY
   oRsDwell:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening DWELLING table" )
   oRsOwn:Close()
   _CleanUP()
   RETURN(.F.)
END TRY

SysReFresh()

// open resident table

cSQL := "SELECT * from RESIDENT where PROPEID = '"+cPROPEID+"' order by ResidentSort,LastName,FirstName"

oRsRes := TOleAuto():New( "ADODB.Recordset" )
oRsRes:CursorType     := 1        // opendkeyset
oRsRes:CursorLocation := 3        // local cache
oRsRes:LockType       := 3        // lockoportunistic

TRY
   oRsRes:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening RESIDENT table" )
   oRsOwn:Close()
   oRsDwell:Close()
   _CleanUP()
   RETURN(.F.)
END TRY

// open pets table

cSQL := "SELECT * from PETS where PROPEID = '"+cPROPEID+"'"

oRsPet := TOleAuto():New( "ADODB.Recordset" )
oRsPet:CursorType     := 1        // opendkeyset
oRsPet:CursorLocation := 3        // local cache
oRsPet:LockType       := 3        // lockoportunistic

TRY
   oRsPet:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening PETS table" )
   oRsOwn:Close()
   oRsDwell:Close()
   oRsRes:CLose()
   _CleanUP()
   RETURN(.F.)
END TRY

// open vehicle table

cSQL := "SELECT * from VEHICLE where PROPEID = '"+cPROPEID+"'"

oRsVeh := TOleAuto():New( "ADODB.Recordset" )
oRsVeh:CursorType     := 1        // opendkeyset
oRsVeh:CursorLocation := 3        // local cache
oRsVeh:LockType       := 3        // lockoportunistic

TRY
   oRsVeh:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening VEHICLE table" )
   oRsOwn:Close()
   oRsDwell:Close()
   oRsRes:CLose()
   oRsVeh:CLose()
   _CleanUP()
   RETURN(.F.)
END TRY

// open boats table

cSQL := "SELECT * from BOATS where PROPEID = '"+cPROPEID+"'"

oRsBoat := TOleAuto():New( "ADODB.Recordset" )
oRsBoat:CursorType     := 1        // opendkeyset
oRsBoat:CursorLocation := 3        // local cache
oRsBoat:LockType       := 3        // lockoportunistic

TRY
   oRsBoat:Open( cSQL,xCONNECT )
CATCH oErr
   MsgInfo( "Error in Opening VEHICLE table" )
   oRsOwn:Close()
   oRsDwell:Close()
   oRsRes:CLose()
   oRsVeh:CLose()
   oRsPet:Close()
   _CleanUP()
   RETURN(.F.)
END TRY

 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: MS Access problem

Postby Armando » Sat Oct 15, 2011 4:44 pm

Rick:

I am glad to hear that.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3218
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: MS Access problem

Postby James Bott » Sun Oct 16, 2011 3:00 pm

Rick,

Playing with this code again last night .. I changed the location
of my table variable oRs objects to the top of my calling program as
static rather than local to the program where the tables are created.


I'm not even sure why that would work unless your entire program is in one PRG. Static vars are visible only in the PRG where they are defined. Are you passing these vars to other functions in other PRGs?


Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: MS Access problem

Postby Rick Lipkin » Sun Oct 16, 2011 3:43 pm

James

This particular .prg just opens the details screen that contains all my folders and relational tables .. the Master property table contains my primary key and I pass the Property table to this module .. open my relational tables and pass the relational tables ( defined with local oRs variables ) downstream to other programs as needed.

I really did not see any difference defining my table oRs variables local to where I initialize and open them, pass them as parameters downstream .. and that worked perfectly till I just happen to start stressing the Property to detail code.

Since they were defined local .. when the detail function returned back and quit .. so did the scope of the local table variables.. seemed clean and tidy. Only when I began opening and closing several properties did I notice the detail function always seem to break after the 10th time and always after the forth table opened .. no matter what table was forth.

I just figured Access was having some IO problems and eventually 'broke' .. again, since the table variables were local .. when the detail returned back to the Property master table .. the scope of the variables were released and not a memory issue.. Only when I open and close the detail down multiple times did the program 'break'

Literally bugged the ( &&$$$%% censored ) out of me. So I decided to open all my tables at one time when the Master property table opened up and use a filter condition to scope my foreign keys in my tables .. and that worked .. I opened and closed about 50 or so records with their detail and the application was very stable.

Obviously I had to go back and re-write my table visibility because all my records are buffered up when the Master property screen comes up .. which presented a challenge of forcing requery() ..

I decided there had to be some crazy reason why consistently the relational table creation function broke in the same place .. had to be a reason. For 'hoots and grins' .. I decided to move the local variables in my static function to the top of the calling .prg and define them as static .. and MUCH to my amazement .. the program quit failing .. of course, now that the variables were static .. I had to NIL them out in the valid close.

Based on that seemingly ( wasn't going to make any difference ) change .. I just concluded .. for some odd strange reason .. the local table variables that were always re-initialized each time I went to the detail .. somehow just lost their visibility .. I can not understand it .. makes no sense, but moving the table oRs variable declaration to the top of the calling program as Static .. seems to have fixed my problem..

Go figure

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 103 guests