Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database relations - child record does not change after SELECT

Status
Not open for further replies.

marka1966

Programmer
Oct 9, 2002
19
0
0
US
I have 4 databases in FPW26 related as follows:

'Actives' related to 'Name'
'Name' related to 'Company'

'Cancels' related to 'Name'
'Name' related to 'Company'

'Actives' and 'Cancels' are the same structure with a cancel date added to the 'Cancels' database. Both are indexed on a numeric 'Recordid' field

Problem:
When I select from 'Actives' to 'Cancels' the related 'Name' and 'Company' database information does not update on the screen nor does the pointer in the 'Name' database change location.

Valid code snippet for the radio button that swaps databases:

DO CASE
CASE m.radio_dbf=1
SELECT actives
=loadfields()
CASE m.radio_dbf=2
SELECT cancels
=loadfields()
ENDCASE
SHOW GETS

********************
PROCEDURE loadfields
********************
DO CASE
CASE ALIAS()='ACTIVES'
SELECT actives
DBFinUse='ACTIVES'
CASE ALIAS()='CANCELS'
SELECT cancels
DBFinUse='CANCELS'
ENDCASE

SCATTER MEMVAR MEMO

SELECT name
SCATTER MEMVAR MEMO

SELECT company
SCATTER MEMVAR MEMO

DO CASE
CASE DBFinUse='ACTIVES'
SELECT actives
CASE DBFinUse='CANCELS'
SELECT cancels
ENDCASE

RETURN
 
The record pointers in your name and company tables doesn't change unless you tell it too. So when you switch to another table, the child tables remain at the current location. Try this:

********************
PROCEDURE loadfields
********************
DO CASE
CASE ALIAS()='ACTIVES'
SELECT actives
DBFinUse='ACTIVES'
CASE ALIAS()='CANCELS'
SELECT cancels
DBFinUse='CANCELS'
ENDCASE

STORE RECNO() TO nTmpRec
GOTO nTmpRec

SCATTER MEMVAR MEMO
.
.
.
Dave S.
 
Thanks,
Works like a charm. I added:

IF EOF()
STORE 1 TO nTmpRec
ELSE
STORE RECNO() TO nTmpRec
ENDIF

GOTO nTempRec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top