if then statement

  • Thread starter sobeit via AccessMonster.com
  • Start date
S

sobeit via AccessMonster.com

cant find the right code for this

if me.field1.value = "VALUE1" and me.field2.value = "VALUE2" then
me.field2.defaultvalue = "VALUE3"
end if

im having the #Name? error on the default value

please help
 
O

OssieMac

Setting the DefaultValue does not necessarily change the field to that value.
Even if the form opens with the default value displayed, the user can still
enter a different value. If you want the field to change as well than insert
another line and force the change.


if me.field1.value = "VALUE1" and me.field2.value = "VALUE2" then
me.field2.defaultvalue = "VALUE3"
me.field2.value = "VALUE3"
end if
 
S

sobeit via AccessMonster.com

sir i am referring to the next record not on the current record thats why i
used the defaultvalue

Setting the DefaultValue does not necessarily change the field to that value.
Even if the form opens with the default value displayed, the user can still
enter a different value. If you want the field to change as well than insert
another line and force the change.

if me.field1.value = "VALUE1" and me.field2.value = "VALUE2" then
me.field2.defaultvalue = "VALUE3"
me.field2.value = "VALUE3"
end if
cant find the right code for this
[quoted text clipped - 5 lines]
please help
 
O

OssieMac

I don't understand what it is you are trying to achieve.

--
Regards,

OssieMac


sobeit via AccessMonster.com said:
sir i am referring to the next record not on the current record thats why i
used the defaultvalue

Setting the DefaultValue does not necessarily change the field to that value.
Even if the form opens with the default value displayed, the user can still
enter a different value. If you want the field to change as well than insert
another line and force the change.

if me.field1.value = "VALUE1" and me.field2.value = "VALUE2" then
me.field2.defaultvalue = "VALUE3"
me.field2.value = "VALUE3"
end if
cant find the right code for this
[quoted text clipped - 5 lines]
please help
 
D

Duane Hookom

Clearly this thread should be posted in the Forms or other news group as it
has nothing to do with Access reports.

--
Duane Hookom
Microsoft Access MVP


OssieMac said:
I don't understand what it is you are trying to achieve.

--
Regards,

OssieMac


sobeit via AccessMonster.com said:
sir i am referring to the next record not on the current record thats why i
used the defaultvalue

Setting the DefaultValue does not necessarily change the field to that value.
Even if the form opens with the default value displayed, the user can still
enter a different value. If you want the field to change as well than insert
another line and force the change.

if me.field1.value = "VALUE1" and me.field2.value = "VALUE2" then
me.field2.defaultvalue = "VALUE3"
me.field2.value = "VALUE3"
end if

cant find the right code for this

[quoted text clipped - 5 lines]

please help
 
S

sobeit via AccessMonster.com

sorry duane i didnt put it in the right group name my mistake

Duane said:
Clearly this thread should be posted in the Forms or other news group as it
has nothing to do with Access reports.
I don't understand what it is you are trying to achieve.
[quoted text clipped - 16 lines]
 

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