Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Custom Dialog Box

Status
Not open for further replies.

pazgb

Programmer
Jun 9, 2003
60
US
Hello,

Our company is still using Access 97.

Is there any examples out there that can show me how to create a custom dialog box using a blank form and VBA code?

We can not use Microsoft's ActiveX control Dialog Box.

Thanks for any help you can give!
 
As a matter of fact Ive just made one.

1) make a normal form and name it "dialog"
2) In the properties put the following
caption - "whatever you want for the forms title"
default view - single form
allow datasheet - no
allow pivot table - no
allow pivotchart view - no
scroll bars - neither
record selectors - no
navigation buttons - no
dividing lines - no
auto resisze - yes
auto center - yes
border style - thin
control box no
3) put a label on the form big enough to fit any messages you want to show. in its caption property put "message" (this will be changed but it needs data entered in the caption or the label will not stay on the form).
4) goto VBA by pressing alt + F11
5) Create a new module (Insert/module on the menubar)
6) type in the following code into the module
Code:
Public Sub Dialog(strmessage As String, strTitle As String)
DoCmd.OpenForm "dialog"
Forms!Dialog.Caption = strTitle
Forms!Dialog!DialogMessage.Caption = strmessage
End Sub
7) save the module and call it "dialogform"
8) now all you have to do to call the dialog box is...

Dialog MessageString, TitleString

where MessageString is the message you wish to display and TitleString is the title which appears on head of the form.

Regards Ian M



Program Error
Why is it, I still think in terms of spectrum BASIC!
 
Thank you for the start!

Unfortantly, I still need to be able to select a file in the dialog box. Is there a way I can create a listbox with the drives,folders and then select the file?

Can anyone help?

Thanks
 
You may like to follow this link to datapig technologies and download the "datapig instant treeview" file at the bottom of the page - the link to the tutorial beside the file doesnt work but the tutorial is in the download file as a exe file. This may not be to your liking because it uses an activex reference.

But it is usefull because it shows the complexities involved in treeview creation.

There are other nice tips on this site too.
Hope this helps.


Program Error
Why is it, I still think in terms of spectrum BASIC!
 
Where can I access the link?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top