If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Help with Returned Result
I downloaded the File Picker routine from Ken Getz:
http://www.mvps.org/access/api/api0001.htm and put it into my database. this is called when the users clicks a cmd button so they can pick a file. the result of this pick should be put into a text box on the same form, so it can be saved in the database. If I debug it, I see where the TestIt function gets the right result, but how do i get that information into the TextBox? (called PicPath) I actually have 3 access books and I'm still getting nowhere. Any help offered would achieve hero status for at least 24hours! Thank you.... here is the code: Function TestIt() Dim strFilter As String Dim lngFlags As Long Dim strInputFileName As String 'Modified 5/3/5 AMc strFilter = ahtAddFilterItem(strFilter, "Jpeg Files (*.jpg)", "*.JPG") 'strFilter = ahtAddFilterItem(strFilter, "Gif Files (*.gif)", "*.GIF") 'strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT") 'strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*") strInputFileName = ahtCommonFileOpenSave(InitialDir:="C:\", _ Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _ DialogTitle:="Please Choose Your File:") ' Since you passed in a variable for lngFlags, ' the function places the output flags value in the variable. MsgBox " " & strInputFileName & " from TestIt" TestIt = strInputFileName Debug.Print Hex(lngFlags) End Function |
#2
|
|||
|
|||
1) In the code for your command button Click event: Private Sub cmdMyButton_Click() Me.txtPicPath = TestIt End Sub Make sure this code is "attached" to the OnClick property of the button. 2) Just to be safe, change Function TestIt() to Function TestIt() As String As written, TestIt is returning a Variant variable. It never hurts to be specific. HTH, -- George Nicholson Remove 'Junk' from return address. "Abbey Normal" wrote in message ... I downloaded the File Picker routine from Ken Getz: http://www.mvps.org/access/api/api0001.htm and put it into my database. this is called when the users clicks a cmd button so they can pick a file. the result of this pick should be put into a text box on the same form, so it can be saved in the database. If I debug it, I see where the TestIt function gets the right result, but how do i get that information into the TextBox? (called PicPath) I actually have 3 access books and I'm still getting nowhere. Any help offered would achieve hero status for at least 24hours! Thank you.... here is the code: Function TestIt() Dim strFilter As String Dim lngFlags As Long Dim strInputFileName As String 'Modified 5/3/5 AMc strFilter = ahtAddFilterItem(strFilter, "Jpeg Files (*.jpg)", "*.JPG") 'strFilter = ahtAddFilterItem(strFilter, "Gif Files (*.gif)", "*.GIF") 'strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT") 'strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*") strInputFileName = ahtCommonFileOpenSave(InitialDir:="C:\", _ Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _ DialogTitle:="Please Choose Your File:") ' Since you passed in a variable for lngFlags, ' the function places the output flags value in the variable. MsgBox " " & strInputFileName & " from TestIt" TestIt = strInputFileName Debug.Print Hex(lngFlags) End Function |
#3
|
|||
|
|||
Thank you! Thank you! Thank you! Neat and Simple.
"George Nicholson" wrote: 1) In the code for your command button Click event: Private Sub cmdMyButton_Click() Me.txtPicPath = TestIt End Sub Make sure this code is "attached" to the OnClick property of the button. 2) Just to be safe, change Function TestIt() to Function TestIt() As String As written, TestIt is returning a Variant variable. It never hurts to be specific. HTH, -- George Nicholson Remove 'Junk' from return address. "Abbey Normal" wrote in message ... I downloaded the File Picker routine from Ken Getz: http://www.mvps.org/access/api/api0001.htm and put it into my database. this is called when the users clicks a cmd button so they can pick a file. the result of this pick should be put into a text box on the same form, so it can be saved in the database. If I debug it, I see where the TestIt function gets the right result, but how do i get that information into the TextBox? (called PicPath) I actually have 3 access books and I'm still getting nowhere. Any help offered would achieve hero status for at least 24hours! Thank you.... here is the code: Function TestIt() Dim strFilter As String Dim lngFlags As Long Dim strInputFileName As String 'Modified 5/3/5 AMc strFilter = ahtAddFilterItem(strFilter, "Jpeg Files (*.jpg)", "*.JPG") 'strFilter = ahtAddFilterItem(strFilter, "Gif Files (*.gif)", "*.GIF") 'strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT") 'strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*") strInputFileName = ahtCommonFileOpenSave(InitialDir:="C:\", _ Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _ DialogTitle:="Please Choose Your File:") ' Since you passed in a variable for lngFlags, ' the function places the output flags value in the variable. MsgBox " " & strInputFileName & " from TestIt" TestIt = strInputFileName Debug.Print Hex(lngFlags) End Function |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Summing Returned Positions using MATCH | Sam via OfficeKB.com | Worksheet Functions | 10 | April 16th, 2005 11:30 PM |
Wrong result from INNER JOIN query if not sorting. | Afzal | Running & Setting Up Queries | 5 | April 2nd, 2005 11:39 AM |
How do I turn dollar amounts into words? | Theresa Wright | New Users | 5 | January 25th, 2005 10:28 AM |
Amount or Numbers in Words | ron | New Users | 9 | December 24th, 2004 07:32 PM |