IF in a forms ON Load event...

P

Peter

Hi All...

I use a popup form to copy text from textfield from an open form..

I want to use this code

If Forms.[Fruitsbasket].[Fruits] = "Yellow" Then
Me.[Fruittype] = "1st_Banana"
End If

I want to use five If's..but for some reason..it does not fire the first
line of IF code...why is that?

Thanks!
 
M

Mike Painter

Peter said:
Hi All...

I use a popup form to copy text from textfield from an open form..

I want to use this code

If Forms.[Fruitsbasket].[Fruits] = "Yellow" Then
Me.[Fruittype] = "1st_Banana"
End If

I want to use five If's..but for some reason..it does not fire the
first line of IF code...why is that?

Thanks!

The only reasons a line would not "fire" would be if there was something
previous that skipped over it or the code was in the wrong event.
 
P

Peter

Thanks Mike..but i do not recevie any error message..the only "line" it the
Sub text "Private Sub Form_Load()" ????????

Thanks!

Mike Painter said:
Peter said:
Hi All...

I use a popup form to copy text from textfield from an open form..

I want to use this code

If Forms.[Fruitsbasket].[Fruits] = "Yellow" Then
Me.[Fruittype] = "1st_Banana"
End If

I want to use five If's..but for some reason..it does not fire the
first line of IF code...why is that?

Thanks!

The only reasons a line would not "fire" would be if there was something
previous that skipped over it or the code was in the wrong event.


.
 
S

Stuart McCall

Peter said:
Hi All...

I use a popup form to copy text from textfield from an open form..

I want to use this code

If Forms.[Fruitsbasket].[Fruits] = "Yellow" Then
Me.[Fruittype] = "1st_Banana"
End If

I want to use five If's..but for some reason..it does not fire the first
line of IF code...why is that?

Thanks!

If Forms![Fruitsbasket].[Fruits] = "Yellow" Then

Notice I changed from Forms. to Forms!

Forms is a collection containing references to all open forms. To refer to a
member of a collection by name, use the Bang (!) syntax as above or
Forms("Fruitsbasket")

Dot is used for properties and methods.
 

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