dbTalk Databases Forums  

Create alert if text from combobox needs to be added in textbox, butcombobox value is not set

comp.databases.ms-access comp.databases.ms-access


Discuss Create alert if text from combobox needs to be added in textbox, butcombobox value is not set in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AA Arens
 
Posts: n/a

Default Create alert if text from combobox needs to be added in textbox, butcombobox value is not set - 07-29-2009 , 07:05 AM






I have a push button that adds the value from a combobox in a text
box. How to get an alert (message) if the value in the combobox is not
set (=empty)?

This is the code (I have it simplified):

Private Sub AddName_Click()
Me.Refresh
If Len(Me.Textbox & "") > 0 Then
Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
If Len(Me.Textbox & "") = 0 Then
Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
End Sub

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Create alert if text from combobox needs to be added in textbox,but combobox value is not set - 07-29-2009 , 07:15 AM






AA Arens wrote:

Quote:
I have a push button that adds the value from a combobox in a text
box. How to get an alert (message) if the value in the combobox is not
set (=empty)?

This is the code (I have it simplified):

Private Sub AddName_Click()
Me.Refresh
If Len(Me.Textbox & "") > 0 Then
If not IsNull(Me.Combo43) then
Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
Else
msgbox "Please select an item from the combo"
Endif
Quote:
End If
End Sub
BTW, what happens if the button is pressed multiple times? Does it keep
on concatenating combo box values?

Reply With Quote
  #3  
Old   
paii, Ron
 
Posts: n/a

Default Re: Create alert if text from combobox needs to be added in textbox, but combobox value is not set - 07-29-2009 , 07:47 AM



Why not disable the push button until the combo box if filled?

In the form's on current event

if nz(Me!Combo42.Value,"") = "" then
Me!AddName.Enabled = False
else
Me!AddName.Enabled = True
endif

In the After update event of the combo box

if nz(Me!Combo42.Value,"") = "" then ' User may have deleted the selection
Me!AddName.Enabled = False
else
Me!AddName.Enabled = True
endif

"AA Arens" <bartvandongen (AT) gmail (DOT) com> wrote

Quote:
I have a push button that adds the value from a combobox in a text
box. How to get an alert (message) if the value in the combobox is not
set (=empty)?

This is the code (I have it simplified):

Private Sub AddName_Click()
Me.Refresh
If Len(Me.Textbox & "") > 0 Then
Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
If Len(Me.Textbox & "") = 0 Then
Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
End Sub

Reply With Quote
  #4  
Old   
AA Arens
 
Posts: n/a

Default Re: Create alert if text from combobox needs to be added in textbox,but combobox value is not set - 07-29-2009 , 09:11 AM



On Jul 29, 7:47*pm, "paii, Ron" <n... (AT) no (DOT) com> wrote:
Quote:
Why not disable the push button until the combo box if filled?

In the form's on current event

if nz(Me!Combo42.Value,"") = "" then
* * Me!AddName.Enabled *= False
else
* * Me!AddName.Enabled = True
endif

In the After update event of the combo box

if nz(Me!Combo42.Value,"") = "" then ' User may have deleted the selection
* * Me!AddName.Enabled *= False
else
* * Me!AddName.Enabled = True
endif

"AA Arens" <bartvandon... (AT) gmail (DOT) com> wrote in message

news:1ea6d9c4-fc38-4e53-abdb-400e114fe6b6 (AT) p10g2000prm (DOT) googlegroups.com...

I have a push button that adds the value from a combobox in a text
box. How to get an alert (message) if the value in the combobox is not
set (=empty)?

This is the code (I have it simplified):

Private Sub AddName_Click()
* Me.Refresh
If Len(Me.Textbox & "") > 0 Then
* Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
If Len(Me.Textbox & "") = 0 Then
* Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
End Sub
Thanks, I used the last solution. Elegant.

Reply With Quote
  #5  
Old   
AA Arens
 
Posts: n/a

Default Re: Create alert if text from combobox needs to be added in textbox,but combobox value is not set - 07-29-2009 , 09:34 AM



On Jul 29, 9:11*pm, AA Arens <bartvandon... (AT) gmail (DOT) com> wrote:
Quote:
On Jul 29, 7:47*pm, "paii, Ron" <n... (AT) no (DOT) com> wrote:



Why not disable the push button until the combo box if filled?

In the form's on current event

if nz(Me!Combo42.Value,"") = "" then
* * Me!AddName.Enabled *= False
else
* * Me!AddName.Enabled = True
endif

In the After update event of the combo box

if nz(Me!Combo42.Value,"") = "" then ' User may have deleted the selection
* * Me!AddName.Enabled *= False
else
* * Me!AddName.Enabled = True
endif

"AA Arens" <bartvandon... (AT) gmail (DOT) com> wrote in message

news:1ea6d9c4-fc38-4e53-abdb-400e114fe6b6 (AT) p10g2000prm (DOT) googlegroups.com....

I have a push button that adds the value from a combobox in a text
box. How to get an alert (message) if the value in the combobox is not
set (=empty)?

This is the code (I have it simplified):

Private Sub AddName_Click()
* Me.Refresh
If Len(Me.Textbox & "") > 0 Then
* Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
If Len(Me.Textbox & "") = 0 Then
* Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
End Sub

Thanks, I used the last solution. Elegant.
How to make it possible that de-activation of the button start as soon
as the combobox is erased? Now it only refresh if I brows to a next
record or I push on the button that then becomes gray.

Reply With Quote
  #6  
Old   
paii, Ron
 
Posts: n/a

Default Re: Create alert if text from combobox needs to be added in textbox, but combobox value is not set - 07-31-2009 , 06:58 AM



Look in help at the On Change event.

"AA Arens" <bartvandongen (AT) gmail (DOT) com> wrote

On Jul 29, 9:11 pm, AA Arens <bartvandon... (AT) gmail (DOT) com> wrote:
Quote:
On Jul 29, 7:47 pm, "paii, Ron" <n... (AT) no (DOT) com> wrote:



Why not disable the push button until the combo box if filled?

In the form's on current event

if nz(Me!Combo42.Value,"") = "" then
Me!AddName.Enabled = False
else
Me!AddName.Enabled = True
endif

In the After update event of the combo box

if nz(Me!Combo42.Value,"") = "" then ' User may have deleted the
selection
Me!AddName.Enabled = False
else
Me!AddName.Enabled = True
endif

"AA Arens" <bartvandon... (AT) gmail (DOT) com> wrote in message

news:1ea6d9c4-fc38-4e53-abdb-400e114fe6b6 (AT) p10g2000prm (DOT) googlegroups.com...

I have a push button that adds the value from a combobox in a text
box. How to get an alert (message) if the value in the combobox is not
set (=empty)?

This is the code (I have it simplified):

Private Sub AddName_Click()
Me.Refresh
If Len(Me.Textbox & "") > 0 Then
Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
If Len(Me.Textbox & "") = 0 Then
Me.Textbox = Me.Textbox & Me!Combo43.Value & vbCrLf
End If
End Sub

Thanks, I used the last solution. Elegant.
How to make it possible that de-activation of the button start as soon
as the combobox is erased? Now it only refresh if I brows to a next
record or I push on the button that then becomes gray.

Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.