Fill a textbox automatically (1 Viewer)

IvaanGarciia

Member
Local time
Yesterday, 22:24
Joined
Mar 5, 2020
Messages
37
Hi Community,

I have an issue trying to do something, actually.. I'm doing an tracking system of devices an I got a form of lease and another of returns, and both of them the date now is activated, for example when I give a device to an employee, I do a lease of a device an the record is saved with the date, I'd like to now how to do for a status Active/Inactive textbox fill with one of these words if the date textbox that contain value.

Regards,
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:24
Joined
Oct 29, 2018
Messages
21,498
Hi. You could try something like:

Code:
=IIf(IsDate([DateField]),"Active","Inactive")

Adjust as needed...
 

IvaanGarciia

Member
Local time
Yesterday, 22:24
Joined
Mar 5, 2020
Messages
37
Hi. You could try something like:

Code:
=IIf(IsDate([DateField]),"Active","Inactive")

Adjust as needed...
Thank you for you quickly reply, this should be has an expression?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:24
Joined
Oct 29, 2018
Messages
21,498
In the case that this valie need to saved in a table Can I add this expression in default value?
Probably not. Default Value only applies to new records. So, when the user updates the selection on an existing record, the default value expression won't do anything. Besides, you really don't need to store this value in a table. You can either just use a Calculated Column in your table or use a Calculated Column in your query source.
 

IvaanGarciia

Member
Local time
Yesterday, 22:24
Joined
Mar 5, 2020
Messages
37
Probably not. Default Value only applies to new records. So, when the user updates the selection on an existing record, the default value expression won't do anything. Besides, you really don't need to store this value in a table. You can either just use a Calculated Column in your table or use a Calculated Column in your query source.
1583771406535.png


I've doing that and it was good, but now I can put a valie to asset textbox xD just because I set the default value in Text318...
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:24
Joined
Oct 29, 2018
Messages
21,498
Hi. Is Asset supposed to say Active or Inactive?
 

IvaanGarciia

Member
Local time
Yesterday, 22:24
Joined
Mar 5, 2020
Messages
37
Hi. Is Asset supposed to say Active or Inactive?
Nope, Asset should be typed, active/inactive it should be a textbox not-visible, when I save a record of an asset linked to an ID automatically save a date and active value in a table.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:24
Joined
Oct 29, 2018
Messages
21,498
Nope, Asset should be typed, active/inactive it should be a textbox not-visible, when I save a record of an asset linked to an ID automatically save a date and active value in a table.
Okay, then I don't understand your previous post. What is the problem?
 

IvaanGarciia

Member
Local time
Yesterday, 22:24
Joined
Mar 5, 2020
Messages
37
Okay, then I don't understand your previous post. What is the problem?
After I type the default value =IIf(IsDate([DateField]),"Active") in the txtbox, the previous textbox asset I'm not able to type a value, and before I can do it
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:24
Joined
Oct 29, 2018
Messages
21,498
After I type the default value =IIf(IsDate([DateField]),"Active") in the txtbox, the previous textbox asset I'm not able to type a value, and before I can do it
Hi. Again, the Default Value property is only for New Records. If you can't type anything in the box, then it sounds like you may have put that expression in the Control Source property instead of the Default Value property. Also, you said the Asset textbox is not supposed to say Asset or Inactive, so why would you set its Default Value to Asset or Inactive?
 

zeroaccess

Active member
Local time
Today, 00:24
Joined
Jan 30, 2020
Messages
671
Active should be the name of a True/False field in your table.

Make a check box on your form and set its control source to that field. Make sure your record source for the form includes that field.

Then you can set the Default property either =True or =False. This default will appear only when creating a new record.
 

IvaanGarciia

Member
Local time
Yesterday, 22:24
Joined
Mar 5, 2020
Messages
37
Active should be the name of a True/False field in your table.

Make a check box on your form and set its control source to that field. Make sure your record source for the form includes that field.

Then you can set the Default property either =True or =False. This default will appear only when creating a new record.
It was solved, actually I'm trying to get an message When I assign a record duplicate.
 

IvaanGarciia

Member
Local time
Yesterday, 22:24
Joined
Mar 5, 2020
Messages
37
I've seen that can send a message of asset duplicate with code, but I got everything done by macros:

1583789518692.png


I'd like to know how to prevent a duplicate asset that don't have date of return (Fecha recepcion field):
1583789689504.png


1583789612944.png

I would have an form for returning assets, and in them we're going to select the date of return and description and inactive status.
 

Users who are viewing this thread

Top Bottom