I am attempting to require certain field be populated with data, save the record, and open a new form in one Event procedure when a Comand Button is selected on Form. Unfortunately, this is erroring out on me or halt messages when attempting to run Macro certain intervals.
HAlT Message is Condition=True, Action Name=Close, Arguments Form, frm_CLLDateEntry, prompt
My code: - Private Sub Command36_Click()
-
Dim box As ComboBox
-
Dim box1 As ComboBox
-
Dim box2 As ComboBox
-
-
Set box = Me![LOB]
-
Set box1 = Me![CALL TYPE]
-
Set box2 = Me![CALL RESULT]
-
-
If IsNull(box) Then
-
MsgBox "You must select Line of Business", vbExclamation, "No Line of Business"
-
box.SetFocus
-
box.Dropdown
-
Cancel = True
-
ElseIf IsNull(box1) Then
-
MsgBox "You must select Call TYPE", vbExclamation, "No Call Result"
-
box1.SetFocus
-
box1.Dropdown
-
Cancel = True
-
ElseIf IsNull(box2) Then
-
MsgBox "You must select Call Result", vbExclamation, "No Call Type"
-
box2.SetFocus
-
box2.Dropdown
-
Cancel = True
-
End If
-
-
Dim stDocName As String
-
-
stDocName = "mcr_AddNew"
-
DoCmd.RunMacro stDocName
-
-
Exit_Command36_Click:
-
Exit Sub
-
-
-
End Sub
2 2781 @Bre035 Cancel = True has no meaning within the Context of a Click() Event unless it is defined in the Form's Code Module or Globally in a Standard Code Module. Should this be the case, it is never a good idea to Declare a Boolean Variable named Cancel. You may also wish to Exit the Routine should any NULLs be found in any of the 3 Combo Boxes. - Private Sub Command36_Click()
-
Dim box As ComboBox
-
Dim box1 As ComboBox
-
Dim box2 As ComboBox
-
Dim stDocName As String
-
-
Set box = Me![LOB]
-
Set box1 = Me![CALL TYPE]
-
Set box2 = Me![CALL RESULT]
-
-
If IsNull(box) Then
-
MsgBox "You must select Line of Business", vbExclamation, "No Line of Business"
-
box.SetFocus
-
box.Dropdown
-
Exit Sub
-
ElseIf IsNull(box1) Then
-
MsgBox "You must select Call TYPE", vbExclamation, "No Call Result"
-
box1.SetFocus
-
box1.Dropdown
-
Exit Sub
-
ElseIf IsNull(box2) Then
-
MsgBox "You must select Call Result", vbExclamation, "No Call Type"
-
box2.SetFocus
-
box2.Dropdown
-
Exit Sub
-
End If
-
-
'Execute only if ALL Combos are polulated
-
stDocName = "mcr_AddNew"
-
DoCmd.RunMacro stDocName
-
End Sub
NeoPa 32,556
Expert Mod 16PB
You can include a macro from within a VBA procedure by simply executing it : - Call DoCmd.RunMacro(MacroName, _
-
[RepeatCount], _
-
[RepeatExpression])
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Roger |
last post by:
Hi All,
I need to call a text box click event programatically. How would I call the
following event procedure from another procedure within the same form:
Private Sub TextBox2_Click(ByVal sender...
|
by: gevayl |
last post by:
Hi,
How does one triger, from a subform event procedure, a main form event
procedure?
Access 2000
Thanks
|
by: Govindaraj K |
last post by:
Hi,
I am working with MDI form , In a child form i am unable to move the
cursor to previous control using the Shift + Tab combination in KEYDOWN
Event procedure. Even i set the tabStop property...
|
by: Adil Akram |
last post by:
I want to cancel an event from its event procedure on some condition, I know
how to do this in VB6 i.e. by setting cancel=true. Please tell me how can I
do this in VB.net I don't know how to use...
|
by: Jason |
last post by:
I have an ASP.NET application in which I would like to call my button click
event (imgSubmitSearch_Click) on the page load if certain criteria are met.
Is this possible?
What is the correct...
|
by: jerry.ranch |
last post by:
I have a series of comboboxes on a form that are used to display forms
in DS view (theres a qry behind it all). This is working well for me.
Some people like to see the data in DS view, some in...
|
by: Robert |
last post by:
Every thing worked fine until all of a sudden, I get the following error
whenever I try to do anything on one of my forms that calls an Event
Procedure. I get the error as soon as the form opens...
|
by: MLH |
last post by:
I have a form, frmUSPSReturnReceipts, with a control named
NotExpectingGreenTickets. The control's Exit event procedure
follows:
Private Sub NotExpectingGreenTickets_Exit(Cancel As Integer)
If...
|
by: AMD_GAMER |
last post by:
Hi,
I am trying to print address labels. I have a form which asks for
the user to input the first name, middle initial, and last name. On
the button click to print the label, I have an event...
|
by: grinder332518 |
last post by:
My Form accesses a Query as follows :
SELECT tblA.A, tblB.B, tblB.C
FROM tblA LEFT JOIN tblB
ON tblA.A = tblB.A
UNION
SELECT tblB.A, tblB.B, tblB.C
FROM tblB LEFT JOIN TblA
ON ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |