add value in a work field (1 Viewer)

vagelisr

Registered User.
Local time
Today, 07:14
Joined
Apr 28, 2011
Messages
87
Hi to all.

I have in my table a field called 15_17_flag
This field take only 2 values. "15" and "17"
I want if the field has value 15 to show in the form in a work field "Value 15"
if has the value 17 show in the form in the same work field "Value 17"

How can i do this.

Thanks and regards.
 

isladogs

MVP / VIP
Local time
Today, 05:14
Joined
Jan 14, 2017
Messages
18,261
If the form control name is WorkField then

Code:
Me.WorkField = "Value " & Me.[15_17_flag]

I recommend you remove all spaces & underscores in your field names.
Better would be Flag1517 or FlagValue
If so, [] are no longer needed

Code:
Me.WorkField = "Value " & Me.FlagValue
 

vagelisr

Registered User.
Local time
Today, 07:14
Joined
Apr 28, 2011
Messages
87
Thanks for your answer ridders

Can you please help me do this in a query???

If also you can send me an example it will be great.

To me more precisely is the flag has value 15 then i want the work field take the value Best Before if has the value 17 the work field take the value Expiration Date

Thanks!!!!
 

isladogs

MVP / VIP
Local time
Today, 05:14
Joined
Jan 14, 2017
Messages
18,261
I wouldn't use a query
Easier to do this in the form design

Attached is a very simple example of what I believe you want.
Adapt as necessary
 

Attachments

  • SetControlValueExample.accdb
    552 KB · Views: 58

vagelisr

Registered User.
Local time
Today, 07:14
Joined
Apr 28, 2011
Messages
87
Another huge favor.

Can you send the file for office 2003?????
 

isladogs

MVP / VIP
Local time
Today, 05:14
Joined
Jan 14, 2017
Messages
18,261
Access 2003 version attached
 

Attachments

  • SetControlValueExample.mdb
    356 KB · Views: 57

vagelisr

Registered User.
Local time
Today, 07:14
Joined
Apr 28, 2011
Messages
87
First of all ridders i really appreciate all your help

The point is : my form is (I use Greek Office) table and they will have a lot of records.
How can i do this.

PS:Look in my access where i want them.
 

Attachments

  • SetControlValueExample.mdb
    676 KB · Views: 67

isladogs

MVP / VIP
Local time
Today, 05:14
Joined
Jan 14, 2017
Messages
18,261
Sorry but I've no idea what you mean
You've just reposted my example db with a few more records
 

vagelisr

Registered User.
Local time
Today, 07:14
Joined
Apr 28, 2011
Messages
87
And with a new screen.
A wand to do the same in my new screen!!!!!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:14
Joined
May 7, 2009
Messages
19,246
there is an easy way without
coding.

show your table in Design view.
on FlagValue field, put this
as Format to the field:

"Value "0;"Value -"0

bring your from in Design
view. Put same Format to the
FlagValue.
 

vagelisr

Registered User.
Local time
Today, 07:14
Joined
Apr 28, 2011
Messages
87
Thank you arnelgp for your time.

Can you make this in the access i have already upload??

Thanks and regards.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:14
Joined
May 7, 2009
Messages
19,246
Create a Query with
from Table1 and use
the Query as RecordSource
of the Form.

See Query1.
 

Attachments

  • aaSetControlValueExample.zip
    31.3 KB · Views: 46

vagelisr

Registered User.
Local time
Today, 07:14
Joined
Apr 28, 2011
Messages
87
Thanks again for your time arnelgp.
Finally i did what i wand and i forget to inform the forum.
The problem is with the iif in the query.
Because the office is in Greek Language i have to use ; instead of ,

PS: Also ofcouse your example work like a charm......

Thanks and regards...
 

Users who are viewing this thread

Top Bottom