browse button in form

M

Maria

Hi,
I have created a form from wich I want to append a link to file in a
table.

I have created a browse button and an action to it that looks like
follows:

Private Sub browseKnapp_Click()

Dim strFilter As String
Dim strInputBildoriginal As String

strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strInputBildoriginal = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Leta rätt på filen...", _
Flags:=ahtOFN_HIDEREADONLY)

Note that in order to call the Save As dialog box, you can use the same
wrapper function by just setting the OpenFile option as False. For
example,


'Ask for SaveFileName
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strSaveBildoriginal = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)

End Function



This is my atempt to adapt the link that were referred to in several
previous posts on this topic. However I get a complation error saying
funciton ahtAddFilterItem() isn't declared. I thought this was
functions that were built in to Access. Isn't it? Should I copy the
whole thing. I'm not quite sure how to use it. It seems like alot of
code to add to one button action.

http://www.mvps.org/access/api/api0001.htm
 
G

Guest

You don't call a module from anywhere. Modules are containers for functions
and subs which you do call. Be aware that you cannot name a module the same
as any function or sub in the module.
You call a sub or function from where ever it is appropriate. It is common
to use a command button's Click event for something like this.
 
M

Maria

OK, thanks... I'm aware of the naming issue.

However now when I got this working I realized it didn't quite do what
I was hoping for.....

I want to view the filename, that I've browsed for, into my text field
not save it in another place. Is there a simpel line of code that I
could write in the action to do that.

/Maria



Klatuu skrev:
 
M

Maria

Ooops.. Too quick it all came to me.


OK, thanks... I'm aware of the naming issue.

However now when I got this working I realized it didn't quite do what
I was hoping for.....

I want to view the filename, that I've browsed for, into my text field
not save it in another place. Is there a simpel line of code that I
could write in the action to do that.

/Maria



Klatuu skrev:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top