By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,477 Members | 1,602 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,477 IT Pros & Developers. It's quick & easy.

Help with VBA

P: n/a
I am trying to work on "message center" for work and running into a
problem with a form

In the form, there is a checkbox, a textbox and a combobox

What I am trying to do is check to see if anything is enter in textbox,
if so, adhere that to the orginal message

then check to see if anything is chosen from the combobox, if so,
adhere that to the message

then check to see if the checkbox is checked, if so, adhere that to the
message.

These events are not mutually exclusive, so someone can do all three,
none of the above, 2 of this or what not, but I have to have the event
play out in that order..

Right now, my code is not recognizing previous actions, for example, it
works if only one of the items is checked or entered.. but if the
checkbox is checked, it skills over the combobox and the textbox, if
something in the combobox is chosen, it ignores the things in the
textbox. Please help, here is a copy of the code:

Private Sub BtnSbmt2_Click()

If Textbox <"" Then
MessHist = Messhist & Textbox
End If

If NewAssign <"" Then
AssignedTo = NewAssign
MessHist = MessHist ' & some kind of NewAssign message
End If

If Check44.Value = True Then
Status = "Closed"
MessHist = MessHist '& some kind of close message
End If

Me.Refresh

End Sub

Jul 18 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
po******@gmail.com wrote:
I am trying to work on "message center" for work and running into a
problem with a form

In the form, there is a checkbox, a textbox and a combobox

What I am trying to do is check to see if anything is enter in textbox,
if so, adhere that to the orginal message

then check to see if anything is chosen from the combobox, if so,
adhere that to the message

then check to see if the checkbox is checked, if so, adhere that to the
message.

These events are not mutually exclusive, so someone can do all three,
none of the above, 2 of this or what not, but I have to have the event
play out in that order..

Right now, my code is not recognizing previous actions, for example, it
works if only one of the items is checked or entered.. but if the
checkbox is checked, it skills over the combobox and the textbox, if
something in the combobox is chosen, it ignores the things in the
textbox. Please help, here is a copy of the code:

Private Sub BtnSbmt2_Click()

If Textbox <"" Then
MessHist = Messhist & Textbox
End If

If NewAssign <"" Then
AssignedTo = NewAssign
MessHist = MessHist ' & some kind of NewAssign message
End If

If Check44.Value = True Then
Status = "Closed"
MessHist = MessHist '& some kind of close message
End If

Me.Refresh

End Sub
I don't understand your problem. Just the same I'll take a stab.

TextBoxes, normally will open as Null if there is no default value. So
asking the question
If NewAssign <""
might not return a result you requst.

You can do things like
If IsNull(NewAssign) Then
or
If NZ(NewAssign,"") <"" Then
instead.
Jul 18 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.