"jodyblau" <jo******@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
What I am trying to do is this: My form has some client data, then the
subform displays hyperlink records to all the documents in that
client's folder.
The parent form launches a dialog which allows the user to select a
document to add to the client folder. Once the document has been
copied into the client folder, the dialog closes, but a record with a
hyperlink has not yet been added to the database.
My subform has a function in it that cycles through the client folder
and adds hyperlink records for each document in the folder, and removes
records if a particular document is nolonger in the folder. (So I
don't think a simple Requery will work for this one)
So my problem, I think, is one of scope. I don't know how to call the
function in the subform from another form. If this was c++ I would
make the function a public member of the class, and would then be able
to call the function that way. I just don't know how to do it with
visual basic.
I haven't really looked into the use of Module's yet. If this is how I
have to resolve this issue, could you give me a simple example?
Thanks,
Jody
That all seems fairly standard. You put you code in the OnClick event of
the button. Now I don't know what code you have to get the path to the new
document, but I assume you know how to do this.
Once you know the path you then copy the file and if this is succesfull you
add the record to the table. As a final step, you requery the subform. No
code needs to be put anywhere but the main form.
The use of modules in Access allows you to write functions which can be
called from anywhere (any form) in your application. For example, if you
wanted the world's simplest example, you could create a new module and write
a public sub in it, e.g.
Public Sub SayHello()
MsgBox "Hello"
End Sub
Then from any form, you could write Call SayHello() to get this to run.
(It's midnight in the UK and I'm going to bed.)