Problem with setting a value in an If statement (1 Viewer)

Inkognito

Registered User.
Local time
Yesterday, 18:20
Joined
Apr 4, 2008
Messages
43
Hi there!:cool:

I am trying to use an If sentence to determine whether a combinationbox is "Bestilling" or "Bestilling_ut" and then set a variable to one of two values.

If Kombinasjonsboks11 = "Bestilling" then forlag = Landsetting
If Kombinasjonsboks11 = "Bestilling_ut" then forlag = Sjosetting

But this isn't working, 'forlag' isn't set to anything at all.:(

I have tried different approaches, using a text field instead of a variable and spreading the if sentence on several lines with endif etc, but nothing seem to be working.:confused:
I really need this to finish my form.

Any help?
 

KenHigg

Registered User
Local time
Yesterday, 21:20
Joined
Jun 9, 2004
Messages
13,327
Maybe your logic is thinking Landsetting and Sjosetting are variables (and maybe they are?)?

Maybe:

If Kombinasjonsboks11 = "Bestilling" then forlag = "Landsetting"
If Kombinasjonsboks11 = "Bestilling_ut" then forlag = "Sjosetting"
 

Inkognito

Registered User.
Local time
Yesterday, 18:20
Joined
Apr 4, 2008
Messages
43
Absolutely perfect! :D

Thx :)
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:20
Joined
Feb 19, 2002
Messages
43,686
If you were not getting a compile error due to the undeclared variables, you should change all your procedures to have the property - Option Explicit - set. Put it at the top of each code module and in Tools/Options set the property to require variable declarations. This could save you hours of debugging.
 

Users who are viewing this thread

Top Bottom