Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Ensuring Combobox has Value entered if another ComboBox has aspecific value

Hi,

I am new to this group and reletavily new to VBA code and Userforms so
please forgive my potential huge knowledge gaps...

I am trying to ensure that if one particular combobox has a value i.e.
'Breach' in it, that before the form can be 'submitted' successfully
another combobox has a value in it. I feel I maybe close with the
code below (but I could be a million miles away as well!):

I am attempting to use code like:

'check for DPA 1st Box
If Trim(Me.DPA.Value) = "" Then
Me.DPA.SetFocus
MsgBox "Please enter whether DPA was successful or not",
vbExclamation, "Not Quite Complete..."
Exit Sub
End If

' Check DPAIF Box
If Trim(Me.DPA.Value) = "Breach" Or "Process Fail" Then
If Trim(Me.DPAIFBox.Value) = "" Then
Me.DPAIFBox.SetFocus
MsgBox "Please select a reason why DPA was not completed successfully"
Exit Sub
End If

I am getting the error message: "Compile Error: Block IF without End
IF"

If the first DPA combobox says "Yes" or "N/A" then it is not essntial
that the DPAIFBox has a value. Hope all this makes sense.


Help would be grately appreciated - and I apoloigise if I have not
conformed to any forum etiquette :)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default Ensuring Combobox has Value entered if another ComboBox has a specific value

Gareth Hardman wrote:

I am new to this group and reletavily new to VBA code and Userforms so
please forgive my potential huge knowledge gaps...

I am trying to ensure that if one particular combobox has a value i.e.
'Breach' in it, that before the form can be 'submitted' successfully
another combobox has a value in it. I feel I maybe close with the
code below (but I could be a million miles away as well!):

I am attempting to use code like:

'check for DPA 1st Box
If Trim(Me.DPA.Value) = "" Then
Me.DPA.SetFocus
MsgBox "Please enter whether DPA was successful or not",
vbExclamation, "Not Quite Complete..."
Exit Sub
End If

' Check DPAIF Box
If Trim(Me.DPA.Value) = "Breach" Or "Process Fail" Then
If Trim(Me.DPAIFBox.Value) = "" Then
Me.DPAIFBox.SetFocus
MsgBox "Please select a reason why DPA was not completed successfully"
Exit Sub
End If


Need another "End If" right here.

I am getting the error message: "Compile Error: Block IF without End
IF"

If the first DPA combobox says "Yes" or "N/A" then it is not essntial
that the DPAIFBox has a value. Hope all this makes sense.


Help would be grately appreciated - and I apoloigise if I have not
conformed to any forum etiquette :)


--
That would be a bug that needs to be found, not strangled to death.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Ensuring Combobox has Value entered if another ComboBox has aspecific value

Hi Auric,

I have tried adding an additional End IF statement, however I now get
a 'Runtime Error 13: Type mismatch' error message. When I select
Debug, it highlights the folowing line of code in yellow:

If Trim(Me.DPA.Value) = "Breach" Or "Process Fail" Then

Any further help on this would be grateful :)
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Ensuring Combobox has Value entered if another ComboBox has aspecific value

On May 9, 8:09*am, Gareth Hardman wrote:
Hi Auric,

I have tried adding an additional End IF statement, however I now get
a 'Runtime Error 13: Type mismatch' error message. *When I select
Debug, it highlights the folowing line of code in yellow:

If Trim(Me.DPA.Value) = "Breach" Or "Process Fail" Then

Any further help on this would be grateful :)


Hi - I have now found a solution to the query - thanks for looing into
it for those that may have :)
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combobox list based on choice in previous combobox Slim Slender[_3_] Excel Programming 0 August 2nd 11 11:37 AM
Combobox list based on choice in previous combobox Slim Slender[_3_] Excel Programming 0 August 2nd 11 11:16 AM
Combobox items based on choice in previous combobox Slim Slender[_3_] Excel Programming 0 August 2nd 11 03:52 AM
Ensuring Correct Vin Number is entered Rocko Excel Discussion (Misc queries) 2 July 2nd 09 07:55 AM
How can you enable a combobox to be "tabbed" or entered out of? Erika Excel Discussion (Misc queries) 0 April 22nd 05 02:41 PM


All times are GMT +1. The time now is 04:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"