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!

Keeping track of TransferText

Status
Not open for further replies.

dimmech

Technical User
Jan 20, 2004
34
0
0
US
I am currently using Transfertext method in a "print" button's on click event to save a .csv file.

I would like to disable autosave for this form, once the user clicks "save" have access save the current record and keep track of this record until it is "printed" to currentdate.csv.

I have worked out the logic below but I do not possess the knowledge to execute it. Any help on this would be great.

___________________________________________________________________

---user form---
disable autosave

on save = save to "tblename" &
set record to: printed = false


---db manager form---
on print = get "unprinted records" from "tblename" &
tranfertext from query of "unprinted records" to currentdate.csv &
set "unprinted records" to: printed = true


-dimmech
 


>---user form---
>disable autosave

You cannot disable autosave.
The best you can do is to detect whether a 'Save' button has been pressed. If not you can stop the record from being saved, but this would mean that the user cannot leave the record without either saving or undoing.
If you create an 'OKToSave' flag variable at module level, you can set it to false in the form_current event, set it to true in the Save button click event. Then test its value in the Form_beforeupdate event and if it is false set the Cancel parameter to true to cancel the update.

>on save = save to "tblename" &
>set record to: printed = false

Put the Printed flag on the form and set it in the Save button click event.


>---db manager form---
>on print = get "unprinted records" from "tblename" &
>tranfertext from query of "unprinted records" to >currentdate.csv &
>set "unprinted records" to: printed = true

You need two queries. A select query which just selects the unprinted records. Use this query for your export.
And an update query. This again selects unprinted records but updates the flag to show them as printed.



 
If you want to disable autosave, you need to have unbound controls on the form.
Populate them with the current values of a record.
Update the record when the user clicks save.

 
Thank you for your responses. I'm sure I will experiment with both disable alternatives.

Could you please include code examples on the following I am not really up on how to code this. I know this is probably basic but then again so am I.

If you create an 'OKToSave' flag variable at module level, you can set it to false in the form_current event, set it to true in the Save button click event. Then test its value in the Form_beforeupdate event and if it is false set the Cancel parameter to true to cancel the update.

Put the Printed flag on the form and set it in the Save button click event.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top