hi to all...
i have a form named customers and i have txtboxes to input all information i needed.
i have a grid that shows all the records in the table customer. works fine on loading. now, i have 2 buttons previous and next respectively. my codes are as follows:
Previous Button:
USE customer
if not BOF()
skip -1
thisform.refresh()
if BOF()
go top
endif
endif
Next Button:
USE customer
if not EOF()
skip
thisform.refresh()
if EOF()
go bottom
endif
endif
Now, my problem is that when i move to another record by clicking next button, my data on the text boxes moves fine and my grid goes white with no data on it, and if i tried to move another record by clicking next button again, the record stays on record 2 and still my grid goes white also.
pls correct my code...
thanks

newbie here...
He3117
As for not saving an incomplete record, you need code in the Save that checks whatever your conditions are for allowing the save and then if the record passes, calls TableUpdate() to perform the save. (This assumes you're using table buffering, which you should be. Check out the Buffering Data topic in the Help file.)
As for prompting the user on exit, I recommend against it. Make a decision how your application will work--either closing an unsaved record will save or closing an unsaved record will abandon the changes. (I recommend saving them.) Then just do it.
Tamar
Vince206
A littel more Expanding .....
Don't forget table space.
Select 0
USE CUSTOMER ALIAS CUST
use does the inital open then use "select" to select the active table.
SELECT Cust
the ALIAS can be the same as the table name.
Select 0
USE CUSTOMER ALIAS CUSTOMER
or
Select 0
use CUSTOMER
this will default the ALIAS to CUSTOMER
if you are useing the form's dataEnvironment it will do the 'use' for you.So you only need to SELECT.
Dave M.
Ben Kitzelman
Replace:
use customer
lines with:
select Customer
IrvineLewis
Expandinfg on Cetin's correct answer. What is happenning is that you are closing and reopening your table on each press of the button. This causes - among other things - the grid to lose binding, therefore it goes blank.
What you should do is open the table once:
USE Customer
then make sure the table is selected on each button press:
SELECT Customer
HTH
beachmalle
thank you all guys for the prompt reply. im really glad there are a buch of good guys here ready to help newbies like me.
it works fine now, and now i want a record pointer on the grid that everytime i move the record, the pointer on the grid moves on the same record as the one on the text boxes. btw, i use data environment to fetch the fields and grid to the form.
how not to save a record if its incomplete and prompt the user to save or cancel record changes if user tried to close the form.
hoping to hear again from you guys.
thanks and more power to you all
Francis
sellison14
AND, instead of using USE once and then select, you can have the customer table in the dataenvironment of the form.
Aleniko
billy_bob123456
Another option is to forgo the SELECT x entirely where you can.
skip 1 in customer
if ( eof( "customer" ) )
go bottom in customer
endif
skip -1 in customer
if ( bof( "customer" ) )
go top in customer
endif
If you want to begin to create classes and reuse these buttons on your forms you can use a container to bundle these controls together and let the container contain all the intelligence:
* cmdPrev.Click()
this.parent.Skip( -1 )
* cmdNext.Click()
this.parent.Skip( 1 )
* container.Skip()
lparameters pnDistance
skip pnDistance in (this.cTable)
if ( bof( this.cTable ) )
go top in (this.cTable)
else
if ( eof( this.cTable ) )
go bottom in (this.cTable)
endif
endif
thisform.Refresh()