Re: If (and( - with VBA



Hi Bob, I checked when the information doesn't match but if the information
match it gives me the error message as well, thank you for your help

"Bob Phillips" wrote:

RowNum = 0
On Error Resum Next
RowNum =
Application.Match(1,(Textbox1.Text=A1:A100)*(Textbox2.Text=B1:B100)*(Textbox3.Text=C1:C100)*(Textbox4.Text=D1:D100),0)
On Error Goto 0
If RowNum = 0 Then

MsgBox " Information doesn't belong to project #"
Else

...
End If

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Eduardo" <Eduardo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9E6574F6-0848-4738-B14D-871F287BFA84@xxxxxxxxxxxxxxxx
Hi and thank you in advance for your help
How do I write an statement that use if and with vba. here is what I need
to
do,
I have information saved in one *** "Projects" with 4 columns, Client,
Project name, Project # and Business. then I have and userform to to apply
expenses against each project so I need to compare the information enter
in
each textbox with the columns in the data base if one of them doesn't
match a
message will show up and will not allow the user to continue until is
fixed.
an example will be
Client= A
Project name = A1
Project # = 1
Business = APP
so in order to apply anything to project # 1 all the others fields entered
have to match A, A1 & APP
I am thinking in something like,
if(and(textbox1=A:A, textbox2=B:B, textbox3=C:C, textbox4=D:D) then
Else
msgbox = " Information doesn't belong to project #"



.