PC Review


Reply
Thread Tools Rate Thread

Combo box change

 
 
=?Utf-8?B?Z21vcmU=?=
Guest
Posts: n/a
 
      4th Mar 2007
Hello!

I've got a userform where I feed text boxes and combo boxes from some fields
on a sheet each time that form is initialized. In the UserForm_Initialize
procedure I feed my combo box cb_status like this :

Private Sub UserForm_Initialize()
With cb_status
.RowSource = ""
.AddItem "P"
.AddItem "C"
.AddItem "N"
.AddItem "A"
End With
cb_status.Text = Cells(1, 3) 'Get the value already entered from the sheet
End Sub

This works perfectly, but the problem occurs when it reaches the
cb_status_Change because I've got conditions in there which I would like the
program to take action only when the user selects a value on one own. I see
that the program considers that when it brings the value from the sheet (when
initializing the userform) cb_status.Text = Cells(1, 3) it is considered like
a change.

Private Sub cb_status_Change()
If cb_status.Value = "A" Then
If MsgBox("Are you sure to cancel?", vbYesNo + vbQuestion) = vbYes
Then
frm_Bid.Enabled = False
Else
cb_status.Value = ""
End If
Else
frm_Bid.Enabled = True
End If
End Sub

How do I tell the program not to take action when it doesn't come from a
human action, but I still want to see the info from the sheet showing as the
value? I hope I am clear with my explainations...

Thanks for your help!
gmore

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Z21vcmU=?=
Guest
Posts: n/a
 
      4th Mar 2007
I just used "AfterUpdate" in my combo box and it seems to work fine. Any
other suggestions are welcome.

"gmore" wrote:

> Hello!
>
> I've got a userform where I feed text boxes and combo boxes from some fields
> on a sheet each time that form is initialized. In the UserForm_Initialize
> procedure I feed my combo box cb_status like this :
>
> Private Sub UserForm_Initialize()
> With cb_status
> .RowSource = ""
> .AddItem "P"
> .AddItem "C"
> .AddItem "N"
> .AddItem "A"
> End With
> cb_status.Text = Cells(1, 3) 'Get the value already entered from the sheet
> End Sub
>
> This works perfectly, but the problem occurs when it reaches the
> cb_status_Change because I've got conditions in there which I would like the
> program to take action only when the user selects a value on one own. I see
> that the program considers that when it brings the value from the sheet (when
> initializing the userform) cb_status.Text = Cells(1, 3) it is considered like
> a change.
>
> Private Sub cb_status_Change()
> If cb_status.Value = "A" Then
> If MsgBox("Are you sure to cancel?", vbYesNo + vbQuestion) = vbYes
> Then
> frm_Bid.Enabled = False
> Else
> cb_status.Value = ""
> End If
> Else
> frm_Bid.Enabled = True
> End If
> End Sub
>
> How do I tell the program not to take action when it doesn't come from a
> human action, but I still want to see the info from the sheet showing as the
> value? I hope I am clear with my explainations...
>
> Thanks for your help!
> gmore
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box contents doesn't change when filtering combo box is chan Joe M. Microsoft Access 2 17th Nov 2009 10:38 PM
Making a combo box change a combo box Mary Hartman Microsoft Access Forms 2 8th Jan 2007 01:22 AM
Make combo boxes change contents depending on other combo boxes =?Utf-8?B?R2x5bm4=?= Microsoft Access Forms 1 9th Dec 2005 01:32 PM
How do I make one combo box change based on another combo box =?Utf-8?B?TWFydHk=?= Microsoft Access Forms 1 22nd Sep 2005 07:35 PM
Text box change when combo box change =?Utf-8?B?a2VubnlrZWU=?= Microsoft Access Forms 6 2nd Apr 2005 06:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:43 PM.