Checkbox variable

B

Basta1980

Hi there,

I wonder if somebody could give me advice regarding how to go about the
following scenario;

I have 1 userform, consisting of 1 multipage control (with three pages). On
one of these pages (no2) there are 3 textboxes, 1 listbox and 1
commandbutton. At the current time I have assigned the code below to the
commandbutton. The textboxes require an user to fill in startdate (tb1),
enddate (tb2 & optional) & username (tb3). The listbox displays several kind
of status indicators. The commandbutton creates a textstring based upon the
information the user provides in tb1, tb2, tb3 & lb1.

As it turns out there should be a variable added to this userform relating
to the listbox. The current situation only allows 1 selection (and multiple
selection would not be my preferred m.o.) leaving the user with limited
options. The variable should provide the possibility of excluding rather than
include just the value selected from the listbox. In other words; search for
status 'new' when I want to include that specific status or search for
anything but 'new' when I want to exclude this specific status hence search
for any other status. The most obvious way to do this is by using a checkbox.
So I tried that yesterday but I couldn't get it to work. I tried a GoTo
statement, Case Else and a few others I'm embarrased to right down here.
Could anyone help me with this?

Private Sub CommandButton2_Click()

'Items

Dim MyData As DataObject
Set MyData = New DataObject
Un = TextBox4.Text
DatumStart = TextBox2.Text
DatumEnd = TextBox3.Text
Stremedy = ListBox2.Value

'Copy the information

MyData.Clear
If DatumEnd = Empty Then
MyData.SetText "'Created By' = """ & Un & """ AND 'Create Date' >= " & """"
& DatumStart & """" & " AND 'Status*' = """ & Stremedy & """"
MyData.PutInClipboard
Unload Me
Else
MyData.SetText "'Created By' = """ & Un & """ AND 'Create Date' >= " & """"
& DatumStart & """" & " AND 'Create Date' < " & """" & DatumEnd & """" & "
AND 'Status*' = """ & Stremedy & """"
MyData.PutInClipboard
Unload Me
End If
End Sub
Regards & best wishes for 2010!

Basta
 
J

joel

If Me.CheckBox1 = True Then
MsgBox ("Box Checked")
Else
MsgBox ("Box Not checked")
End I
 
B

Basta1980

Hi Joel,

Though the actual suggestion did not work for me it did give me an idea. I
solved the problem by creating two checkboxes.

Regards
 

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