Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

getting a string into a textbox on form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PaulFort - 06 Apr 2005 21:23 GMT
I have successfully used the method at:
http://www.mvps.org/access/api/api0001.htm
to create a browse function for my form.(User can browse to find the name of
an image file he wants to include in the table the form is based upon.)

All I need to do is get the name of the file the user browses to and selects
into a text box on my form  (so that it can be written to the table).

To enable the browsing by the user, I put the following code into the 'on
click' event of a button on the form. (I also created a 'Browse File' module
per instructions on web page above.)

I figured the "strInputFileName" contains the name of the file...but how do
I put that into the text box on the form? (I know it's something real basic I
am asking.Just can't find the answer by searching the help files using my
keywords)

****begin code******
strInputFileName = ahtCommonFileOpenSave( _
               Filter:=strFilter, OpenFile:=True, _
               DialogTitle:="Please select an input file...", _
               Flags:=ahtOFN_HIDEREADONLY)
****end code******

Thanks much,
Paul
Graham Mandeno - 07 Apr 2005 03:01 GMT
Hi Paul

If Len(strInputFileName) <> 0 Then
   Me.[name of textbox] = strInputFileName
End If

The reason to check the length first is that if the user clicks the Cancel
button, the function will return a zero-length string.  In this case, you
presumably do not want to overwrite the previous contents of the textbox.
Signature

Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

>I have successfully used the method at:
> http://www.mvps.org/access/api/api0001.htm
[quoted text clipped - 27 lines]
> Thanks much,
> Paul
PaulFort - 09 Apr 2005 13:11 GMT
Thanks much, Graham. That's what I needed.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.