IF in a forms ON Load event...

  • Thread starter Thread starter Peter
  • Start date Start date
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!
 
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.
 
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.


.
 
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.
 
Back
Top