PopUp an Entry Box in Code

K

Kahuna

Hi Folks - getting brain fade here. Should be simple but guess I'm
over-complicating it!

I have a form with a list (subform table) of reports available to print or
preview etc. I have one button that takes the form name and saves it as a
Snapshot to a specified location.

I'd like to be able to ask the user the file name to use also, but cant
figure the logic of how to do this easily.

I know I can
1. Use the Save Snapshot button to open a form and harvest the user input
for the file name.
2. Feed the FileName to a Function and have the function save the file.

But the code is already functional in the button (Save Snapshot) on the main
form and I don't really want to have to harvest all the form data (name of
report etc) to the function.

What I guess I'm looking for is a mechanism to open a data entry form
(somewhat like a parameter form opening from a query) from the Save Snapshot
button, and have my main code wait for the entry! Obviously I'm able to open
the form - but waiting for the data from the forms OK button beats me!

Is that possible - or sensible even?
 
G

Guest

Make the form you want to use to gather the data a modal form. When you open
a modal form, code execution pauses until you close the modal form, then
continues on the line following the OpenForm line.
 
A

Albert D. Kallal

You can using inputbox()

strFilename = Inputbox("please enter name of file")

if strFileName = "" then
user hit cancel code goes here..

end if


Or, you can build a custom form that prompts the user (your calling code
will wait). How to make code pause, wait for user input, and return a value
is explained here:

http://www.members.shaw.ca/AlbertKallal/Dialog/Index.html

And, you can also pop open the standard windows dialog, and browse to a file
location. That code is here:

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

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