Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make and IF statement on a form 2

Status
Not open for further replies.

Cabrita

Technical User
Apr 3, 2002
140
PT
Hello,

I have a form with a bottom and I would like that bottom to look a value on a value on a table and give me a result, something like this:

IF
[field1]=1 then .....

IF
[flied1]=2 then ...

But I don't know how to write it so that it works.

Thank you for your help.

Andre
 
If I understand correctly then you have to check DLookup Function in the VBA help files

Zameer Abdulla
Visit Me
 
Hi Cabrita,

I think you want to do this
Code:
  If Me![COLOR=#ff0000][FormControlName][/color] Then
      
   [COLOR=#ff0000]execute some code[/color]     
         
    
   Else
     [COLOR=#ff0000]execute some more code[/color] 
      
   End If

To reference a control on a Form use Me![controlname]
 
Thanks ZmrAbdulla,

I think that can solve my problem, I'll try to to it to work.

Best Regards

Andre
 

Hello,

This is the expression I have built usinf the help in VB, but I get the followinw error message "Type mismatch"


If DLookup("[Loja]", "XXX - Utilizador Actual", "[gerente]" = 1) = 2 Then


Me.Space1.SourceObject = "A1 - Recebimentos e Descontos"

End if

any ideas?

Thanks

Andre
 
Can anyone give an hand? Thank you!
 
Try:
Code:
DLookup("[Loja]", "XXX - Utilizador Actual", "[gerente] = 1")

hth

Ben

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
Want to get great answers to your Tek-Tips questions? Have a look at F
 
You're welcome, thanks for the star.

B

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
Want to get great answers to your Tek-Tips questions? Have a look at F
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top