To All
I have a Customer Module that Opens 3 tables from a MS Access database and when I chose a different customer the tables get refreshed by closing them and re-opening them( _custedit() ). The close and re-open process works GREAT on 32 bit Windows XP, but times out on the re-open [Customer Item] table and breaks in the _CustEdit Function.
Here is the code .. all the oRs variables were defined local at the top of the program and passed normally thru the various Functions.
Again, this code works flawlessly on WinXP .. but 'barfs' using Windows 7. I have tried to stay away from using Static oRs variables because this is a MDI application and if the Customer module is opened twice on I have memory 'bleed thru' problems between Customer modules.
Any advice would be welcome ..
Rick Lipkin

I have a Customer Module that Opens 3 tables from a MS Access database and when I chose a different customer the tables get refreshed by closing them and re-opening them( _custedit() ). The close and re-open process works GREAT on 32 bit Windows XP, but times out on the re-open [Customer Item] table and breaks in the _CustEdit Function.
Here is the code .. all the oRs variables were defined local at the top of the program and passed normally thru the various Functions.
Again, this code works flawlessly on WinXP .. but 'barfs' using Windows 7. I have tried to stay away from using Static oRs variables because this is a MDI application and if the Customer module is opened twice on I have memory 'bleed thru' problems between Customer modules.
Any advice would be welcome ..
Rick Lipkin
/Top of Customer module
//------------------------
Func _CustView( cMode,oWndMain )
Local oDlg,lOk1,cSay,oSay,cDefa
Local oRsCust,oRsInvoice,oRsShip,oRsItem
oRsCust := " "
oRsInvoice := " "
oRsShip := " "
oRsItem := " "
cDEFA := SET(7)
LightGreyGrad()
lOK1 := .F.
DEFINE DIALOG oDlg RESOURCE "FILECHK" ;
TITLE "Please be patient"
cSAY := "Opening Tables"
REDEFINE SAY oSay var cSay ID 120 of oDLG UPDATE
oDLG:bStart := { || lOK1 := _OpenUm0( oDLG,oSAY,@cSAY,@oRsCust,@oRsInvoice,@oRsShip,@oRsItem ) }
ACTIVATE DIALOG oDLG CENTERED
oSay := NIL
cSay := NIL
IF lOK1 = .F.
RETURN(NIL)
ENDIF
_CustView1( "A",oWndMain,oRsCust,oRsInvoice,oRsShip,oRsItem)
Return(.t.)
//----------------
Static Func _OpenUm0( oDlg, oSay,cSay, oRsCust,oRsInvoice,oRsShip,oRsItem )
Local cSql,oErr
cSay := "Opening Customer Table"
oSay:ReFresh()
SysReFresh()
// relational key
cSQL := "SELECT * from CUSTOMER order by [Last Name],[First Name]"
oRsCust := TOleAuto():New( "ADODB.Recordset" )
oRsCust:CursorType := 1 // opendkeyset
oRsCust:CursorLocation := 3 // local cache
oRsCust:LockType := 3 // lockoportunistic
TRY
oRsCust:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening CUSTOMER table" )
oDlg:End()
RETURN(.F.)
END TRY
oRsCust:Filter := ""
oRsCust:Filter := "[Last Name] = 'bogus'"
// service address tab
cSay := "Opening Customer ShipTo Table"
oSay:ReFresh()
SysReFresh()
cSQL := "SELECT * from [CUSTOMER SHIPTO] where 1 = 2 order by [Customer Id], [Address1]"
oRsShip := TOleAuto():New( "ADODB.Recordset" )
oRsShip:CursorType := 1 // opendkeyset
oRsShip:CursorLocation := 3 // local cache
oRsShip:LockType := 3 // lockoportunistic
TRY
oRsShip:Open( cSQL,xCONNECT )
CATCH oErr
oRsCust:Close()
MsgInfo( "Error in Opening CUSTOMER SHIPTO table" )
oDlg:End()
RETURN(.F.)
END TRY
// electronics tab
cSay := "Opening Customer Item Table"
oSay:ReFresh()
SysReFresh()
cSql := "SELECT "
cSql += "[Key],[Customer Id],[Model Number],[Manufacturer Name],[Product Class],[Serial Number] "
cSql += "From [Customer Item] "
cSql += "Where 1 = 2 Order by [Customer Id],[Serial Number]"
oRsItem := TOleAuto():New( "ADODB.Recordset" )
oRsItem:CursorType := 1 // opendkeyset
oRsItem:CursorLocation := 3 // local cache
oRsItem:LockType := 3 // lockoportunistic
TRY
oRsItem:Open( cSQL,xCONNECT )
CATCH oErr
oRsCust:Close()
oRsShip:Close()
MsgInfo( "Error in Opening CUSTOMER ITEM table" )
oDlg:End()
RETURN(.F.)
END TRY
// invoice table
cSay := "Opening Invoice Table"
oSay:ReFresh()
SysReFresh()
cSql := "SELECT "
cSql += "[Repair Number], [Transaction Type], [Customer Id],[Invoiced Date], "
cSql += "[Total], [Balance] "
cSql += "From Invoice where 1 = 2 Order by [Invoiced Date] DESC"
oRsInvoice := TOleAuto():New( "ADODB.Recordset" )
oRsInvoice:CursorType := 1 // opendkeyset
oRsInvoice:CursorLocation := 3 // local cache
oRsInvoice:LockType := 3 // lockoportunistic
TRY
oRsInvoice:Open( cSQL,xCONNECT )
CATCH oErr
oRsCust:CLose()
oRsShip:CLose()
oRsItem:CLose()
MsgInfo( "Error in Opening INVOICE table" )
oDlg:End()
RETURN(.F.)
END TRY
oDlg:End()
Return(.t.)
//-------------------------------
FUNC _Custview1( cMODE,oWnd,oRsCust,oRsInvoice,oRsShip,oRsItem )
...
...
...
// double click on xBrowse new Customer and I close and reopen the tables and here
// is where I have problems
oLbx:bLDblClick := { |nRow,nCol | _CustEdit( oRsCust,oRsShip,oRsItem,oRsInvoice,cCustomerId ..... )
...
...
//---------------------
Static Func _CustEdit( oRsCust,oRsShip,oRsItem,oRsInvoice,cCustomerId... more variables )
...
_OpenUm( oDLG,oSAY,cSAY,oRsItem,oRsInvoice,oRsShip,cCustomerId )
...
...
// sets up the recordset for this customer down stream
//--------------------
Static Func _OpenUm( oDLG,oSAY,cSAY,oRsItem,oRsInvoice,oRsShip,cCustomerId )
...
...
DEFINE DIALOG oDlg RESOURCE "FILECHK" ;
TITLE "Please be patient"
cSAY := "Opening Tables"
REDEFINE SAY oSay var cSay ID 120 of oDLG UPDATE
oDLG:bStart := { || lOK1 := _OpenUm( oDLG,oSAY,@cSAY,oRsItem,oRsInvoice,oRsShip,cCustomerId ) }
ACTIVATE DIALOG oDLG CENTERED
oSay := NIL
cSay := NIL
IF lOK1 = .F.
Return(.f.)
ENDIF
oLbxA:MakeTotals() // invoices
oLbxA:ReFresh()
oLbx2:ReFresh() // service items
oLbx3:ReFresh() // service locations
Endif
Return(.t.)
//--------------------------
Static Func _OpenUm( oDLG,oSAY,cSAY,oRsItem,oRsInvoice,oRsShip,cCustomerId )
Local cSql,oErr
oRsItem:Filter := ""
oRsItem:CLose()
oRsInvoice:Filter := ""
oRsInvoice:Close()
oRsShip:Filter := ""
oRsShip:CLose()
cSay := "Opening Item Customer ShipTo Table"
oSay:ReFresh()
SysReFresh()
cSQL := "SELECT * from [CUSTOMER SHIPTO] where [Customer Id] = '"+alltrim(cCustomerId)+"'"
cSql += " order by [Customer Id], [Address1]"
TRY
oRsShip:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening CUSTOMER SHIPTO table" )
oDlg:ENd()
RETURN(.F.)
END TRY
cSay := "Opening Invoice Table"
oSay:ReFresh()
SysReFresh()
cSql := "SELECT "
cSql += "[Repair Number], [Transaction Type], [Customer Id],[Invoiced Date], "
cSql += "[Total], [Balance] "
cSql += "From Invoice Where [Customer Id] = '"+alltrim(cCustomerId)+"'"
cSql += " Order by [Invoiced Date] DESC"
TRY
oRsInvoice:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening INVOICE table" )
oDlg:ENd()
RETURN(.F.)
END TRY
////////////////////
//////////////// locks up here on this table
//////////////// only with Window 7
/////////////////
cSay := "Opening Item Detail Table"
oSay:ReFresh()
SysReFresh()
cSql := "SELECT "
cSql += "[Key],[Customer Id],[Model Number],[Manufacturer Name],[Product Class],[Serial Number] "
cSql += "From [Customer Item] "
cSql += "Where [Customer Id] = '"+alltrim(cCustomerId)+"' Order by [Customer Id],[Serial Number]"
TRY
oRsItem:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening CUSTOMER ITEM table" )
RETURN(.F.)
END TRY
oDlg:End()
Return(.t.)