Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub FormatDialog(frmname As String)
Dim frm As Form
Dim prp As Property
DoCmd.OpenForm frmname, acDesign, , , , acHidden
Set frm = Forms(frmname)
With frm
.AllowDesignChanges = False
.AutoCenter = True
.AutoResize = False
.BorderStyle = 3 'Dialog
.ControlBox = False
.DefaultView = 0 'single form
.DividingLines = False
.Modal = True
.NavigationButtons = False
.ScrollBars = 0 'none
.RecordSelectors = False
.ViewsAllowed = 1 'form
'.WindowHeight = 5310
'.WindowWidth = 10755
End With
Set frm = Nothing
DoCmd.Close acForm, frmname, acSaveYes
End Sub
Option Compare Database
Option Explicit
Const MB_DEFBUTTON1 = &H0&
Const MB_DEFBUTTON2 = &H100&
Const MB_DEFBUTTON3 = &H200&
Const MB_ICONASTERISK = &H40&
Const MB_ICONEXCLAMATION = &H30&
Const MB_ICONHAND = &H10&
Const MB_ICONINFORMATION = MB_ICONASTERISK
Const MB_ICONQUESTION = &H20&
Const MB_ICONSTOP = MB_ICONHAND
Const MB_OK = &H0&
Const MB_OKCANCEL = &H1&
Const MB_YESNO = &H4&
Const MB_YESNOCANCEL = &H3&
Const MB_ABORTRETRYIGNORE = &H2&
Const MB_RETRYCANCEL = &H5&
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Private Sub Form_Load()
MessageBox Me.hwnd, "My message", CurrentProject.Name, MB_YESNOCANCEL
MessageBox Me.hwnd, "My message", "My custom title", MB_ABORTRETRYIGNORE
End
End Sub
<[URL unfurl="true"]http://www.allapi.net/>[/URL] Altered a little
dim answer as integer
answer = msgbox (" My msg ",VBQuestion+VBYesNO,"DBAdmin")
if anwer = vbNo then
exit sub
else
docmd.openform.........
endif
end sub
Private Sub Form_Load()
MessageBox Me.hwnd, "My message", CurrentProject.Name, MB_YESNOCANCEL
MessageBox Me.hwnd, "My message", "My custom title", MB_ABORTRETRYIGNORE
End
End Sub
Private Sub Command1_Click()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "click yes for form Dept600 to appear and " & _
"click No for form Dept650 to appear"
' Define message.
Style = vbYesNoCancel + vbInformation
Title = "Choose Your file" ' Define title.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then
MyString = "Yes"
DoCmd.OpenForm "Dept600"
Else
If Response = vbNo Then
MyString = "No"
DoCmd.OpenForm "Dept650"
Else
'do nothing
End If
End If
End Sub
On Error GoTo Err_CmdExport_Click
Dim stDocName600 As String
Dim stDocNameCont As String
Dim stLinkCriteria As String
Dim answer As Integer
stDocName600 = "SpendingView600"
stDocNameCont = "SpendingViewCont"
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "click yes for form Dept600 to appear and " & _
"click No for form Dept650 to appear"
' Define message.
Style = vbYesNoCancel + vbInformation
Title = "Choose Your file" ' Define title.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then
MyString = "Yes"
DoCmd.OpenForm stDocName600, , , stLinkCriteria
Else
If Response = vbNo Then
MyString = "No"
DoCmd.OpenForm stDocNameCont, , , stLinkCriteria
Else
'do nothing
End If
End If
Exit_CmdExport_Click:
Exit Sub
Err_CmdExport_Click:
MsgBox Err.Description
Resume Exit_CmdExport_Click
End Sub
'the ID's of the buttons on the message box
'correspond exactly to the values they return,
'so the same values can be used to identify
'specific buttons in a SetDlgItemText call.
SetDlgItemText wParam, IDABORT, [b]"Dept 600"[/b]
SetDlgItemText wParam, IDRETRY, [b]"Dept 650"[/b]
SetDlgItemText wParam, IDIGNORE, "Cancel"
'Change the dialog prompt text ...
SetDlgItemText wParam, IDPROMPT,[b] "Select the form you want to view"[/b]
Select Case MessageBoxH(Me.hwnd, GetDesktopWindow())
Case IDABORT: DoCmd.OpenForm "SpendingView600"
Case IDRETRY: DoCmd.OpenForm "SpendingViewCont"
Case IDIGNORE:
End Select
'the ID's of the buttons on the message box
'correspond exactly to the values they return,
'so the same values can be used to identify
'specific buttons in a SetDlgItemText call.
SetDlgItemText wParam, IDABORT, "Dept 600"
SetDlgItemText wParam, IDRETRY, "Dept 650"
SetDlgItemText wParam, IDIGNORE, "Cancel"
'Change the dialog prompt text ...
SetDlgItemText wParam, IDPROMPT, "Select the form you want to view"