Invalid property value.

D

Don Wiss

I have a multipage form in xl2002. After adding some code it has been
giving me an error message if I run a line of code that sets the focus (in
an input error routine). I then get the exact equivalent of:

MsgBox "Invalid property value.", vbExclamation, "Microsoft Forms"

This MsgBox then pops up twice if I try to change tabs, which it then won't
let me do. Or it pops up once if I try to close the form with a cancel,
which it also then won't let me do. I can close the form with the X in the
upper right, but then after the form closes I get this MsgBox.

The line of code with the SetFocus was copied from elsewhere. What is
different on these lines is I am setting the focus on a combo box with a
value that is no longer in the RowSource range. If I comment out the
SetFocus line, run the error code, and set the focus there manually, I have
no problems. The combo box has match required.

I can, of course, not have the program set the focus and let the user
figure out which input has the error. Or I could clear the wrong input.
Neither is ideal. Any other suggestions?

Don <www.donwiss.com> (e-mail link at home page bottom).
 
T

Tom Ogilvy

Since only values in the list are valid, why not alter the properties to
make it a dropdown - the user must select from the list. Then if you set a
default value, there is no validation required.
 
D

Don Wiss

Since only values in the list are valid, why not alter the properties to
make it a dropdown - the user must select from the list. Then if you set a
default value, there is no validation required.

You've lost me Tom. The situation is the choices on the combo box depend on
a checkbox on the first tab. It is possible that someone checks that box.
Then makes a combo box selection that is only for when checked. Then they
uncheck the box. Now the combo box selection is no longer valid. And it is
no longer a choice on the combo box. I have to edit for such a situation.
The Match = True won't help me here.

Don <www.donwiss.com> (e-mail link at home page bottom).
 
E

Excelente

Don,

I get the same exact error message from my form. I don't know how to
debug it either because it appears before any line of code can be
stepped-through (F8). I don't have the Multi-page like you, but mine
is a single page form that has one drop-down (and some buttons, etc )
which I use with an OnChange routine.

When I manually clear the item in the drop-down using the back-space
key, it clears the control. But the error pops up each and every time
I close the dialog box with the "x" top right or cancel button. Seems
that it doesn't like something but when I put a stop in the userform
terminate the error occurs before the stop. So I can't figure out how
to isolate the code in question. Really, I'm not sure what code is
running at all when the form is closed.

When the control is not clear but has data, NO ERROR message.

Did you figure out your problem yet? Could your solution perhaps help
me with my problem?

Michael
 
D

Don Wiss

Excelente said:
Did you figure out your problem yet? Could your solution perhaps help
me with my problem?

I threw in the towel. I simply no longer do the SetFocus on the combobox
with the wrong value. In my error message I tell them which layer has the
error.

I did dust off this past week a form I developed some years back. We now
have the database it needs to be useful. In playing with it I got an
Invalid property value! In this case the value was blank. This as I changed
the first combobox, and the lists for the subsequent ones changed. Along
with changing the first I cleared all the subsequent ones (and changed
their lists). A blank entry I gather isn't a match=true entry. I haven't
yet investigated this "new" form to see if I can do something about it.

Don <www.donwiss.com> (e-mail link at home page bottom).
 
E

Excelente

Don said:
A blank entry I gather isn't a match=true entry. I haven't
yet investigated this "new" form to see if I can do something about
it.

Thank you very much for responding. I believe what you are now
experiencing is similar to what I am in that a blank value is not
allowed for some reason. If I figure something out I'll post my
findings. Hope you will do the same.
 
D

Don Wiss

Excelente said:
Thank you very much for responding. I believe what you are now
experiencing is similar to what I am in that a blank value is not
allowed for some reason. If I figure something out I'll post my
findings. Hope you will do the same.

I will post, or e-mail, but it could be a month from now. I have endless
programming projects, so I'm not sure when I'll get to that one.

Don <www.donwiss.com> (e-mail link at home page bottom).
 
D

Don Wiss

Excelente said:
Thank you very much for responding. I believe what you are now
experiencing is similar to what I am in that a blank value is not
allowed for some reason. If I figure something out I'll post my
findings. Hope you will do the same.

I spent a couple minutes looking at some code I wrote a few years ago that
dealt with the match errors. I grabbed two chunks of code which I leave to
you to try to figure out. You will see that I was changing the
MatchRequired property back and forth. In these two macros the ClassGroup
combo is before the Class. What is displayed in Class depends on which
ClassGroup is chosen. And above ClassGroup is line of business, which each
have different ClassGroups. It is likely that I could use these to solve
the problem I started this thread about.

Private Sub cbClass_Enter()
cbClass.MatchRequired = True
End Sub

Private Sub cbClassGroup_Change()
' this is the macro running flag
' [probably better to use Application.EnableEvents=True/False]
If MRFlag = True Then Exit Sub

' populate the Class combo box
If IsNull(cbClassGroup.Value) Or cbClassGroup.Value = "" Then
Exit Sub
End If

' we clear the ILF code, as they may be switching Sublines
cbILF.Value = ""
lbExpBase.Caption = ""
txtBLC.Value = ""

' here we call the SQL, and then either we display an error or
' write data to combo box
Call Get_Data(statecls_GL1, sql, True)
If ErrFlg = 1 Then Exit Sub
cbClass.Clear
cbClass.MatchRequired = False
cbClass.List = data
txtClassCode.Value = ""

End Sub
 

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