Sequential Transaction Number  
Author Message
DETNYRE





PostPosted: Visual FoxPro General, Sequential Transaction Number Top

I'm working on a form that needs to have a sequential transaction number.

I have a Database/Table (named Trans) in place that has a single record that holds the next transaction number.

I'm not sure what the best way is to have the next transaction number appear in a field on my form.

Right now I have a field named T_TRANSNUM that has it's data property set to w_trans.t_transnum. t_transnum is the name of the database field where I want the transaction number stored when the form is saved.

In the INIT method of T_TRANSNUM I have the following:

STORE 0 TO T_VALUE
SELECT TRANS
GOTO 1
STORE trans.trans_num to T_VALUE
REPLACE trans.trans_num with T_VALUE + 1
this.value = T_value

What is happening is that the value is displayed in the form, but is not being saved to the w_trans_t_transnum field when saved

Any advise on how this should be done properly so the value is saved

Derek



Visual FoxPro1  
 
 
CetinBasoz





PostPosted: Visual FoxPro General, Sequential Transaction Number Top

It's not clear what you're trying to do. What does "a field named T_transnum that has it's data property set to w_trans.t_transnum" mean Where is that "data" property

I can't see any code that would effect T_transnum field. Maybe you're talking about a buffered table where tableupdate is never called, not sure.


 
 
DETNYRE





PostPosted: Visual FoxPro General, Sequential Transaction Number Top

Sorry for the confusing post.

What I meant to say is that the field named T_TRANSNUM has the control source property (set on the data tab of the properties window) set to w_trans.t_transnum.

w_trans.t_transum is the field in the database that I want to have the transaction number saved in.

In the INIT method of the T_TRANSNUM field on the form I have the following:

STORE 0 TO T_VALUE
SELECT TRANS
GOTO 1
STORE trans.trans_num to T_VALUE
REPLACE trans.trans_num with T_VALUE + 1
this.value = T_value

What is happening is that the value is displayed in the form, but is not being saved to the w_trans_t_transnum field when saved

Any advise on how this should be done properly so the value is saved

Derek



 
 
collide





PostPosted: Visual FoxPro General, Sequential Transaction Number Top

hi there..ive tried using the code you posted and it worked for me...when i try to run the code, the field on the table is already updated with the new value but the textfield displays the number stored field of the table(here's what happened there: the textfield retrieves from the field on the table eg. the value is 1 and then you replaced that value with 2 since you increment it with 1 but the value displayed in the textbox is still 1 because you didnt increment the t_value in the textbox)

STORE 0 TO T_VALUE
SELECT TRANS
GOTO 1
STORE trans.trans_num to T_VALUE
REPLACE trans.trans_num with T_VALUE + 1
this.value = T_VALUE+1


...im just wondering, i think you should change the display of the textbox with the new value since you want to save the new transaction number and also i think you should retrieve the last transaction number in the table so that it will increment the last transaction number and will add a new row with the new transaction number...(if thats what u want to happen,you can try this)

STORE 0 TO T_VALUE
SELECT TRANS
GOTO bottom
STORE trans.trans_num to T_VALUE
APPEND BLANK
REPLACE trans.trans_num with T_VALUE + 1
this.value = T_VALUE+1

i hope it works for you =)

 
 
Tamar E. Granor





PostPosted: Visual FoxPro General, Sequential Transaction Number Top

Is w_Trans buffered If so, are you issuing TableUpdate()

Tamar