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!

Move contents of textbox to textbox-command button

Status
Not open for further replies.

Duplicity

Technical User
Feb 16, 2003
18
0
0
GB
I can do this in Visual Basic but on an Access form it has me flumoxed. (Why is VBA so completely different to VB in so many regards ?)

What I have is a common dialog that allows me to select a file and copy its filepath to a textbox on a subform. That part works just fine.

After the above selection has been performed, I'd like to set up another command button that will transfer the filepath from the original textbox to another textbox where the filepath name will be stored in a data table.

txtOpenFile is the name of the textbox that holds the returned filepath name from the common dialog.

txtInvoice is the name of the textbox I'd like to be able to transfer the txtOpenFile text to.

txtInvoice has a control source where the filepath of the selected invoice will be stored in a data table. txtOpenFile is unbound and its job is simply as a temporary destination for the filepath name of the file selected from the common dialog.

Both textboxes are on the same subform and if I can successfully transfer the filepath name to the txtInvoice textbox it will be saved as part of a customers records.

As an aside, I'd also like to know if it's possible to set a final command button up that will open the file based on its filepath name stored in txtInvoice, keeping in mind that as customer records are browsed, whichever invoice belongs to the current formview customer will be listed. The file type will always be Excel and I was thinking along the lines of ShellExecute txtInvoice.text\*.* and so on.

Any thoughts anyone ?

It's driving me nuts.

I'm getting too old for this...

 
In the txtOpenFile textbox's AfterUpdate or Exit event add the following code:

me.txtInvoice = me.txtopenFile

To open the file from your form as records are browsed, try storing the txtInvoice as a hyperlink. Set the Invoice field in the underlying table to a field type of Hyperlink. Then it is simply a matter of clicking the entry in the form to open the appropriate program and then open the file.

Check the Create a Hyperlink topic in the Access On-line help file, and the Hyperlink Property topic in the VBA On-line Help (A2K and XP).

HTH
Lightning
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top