Solved Getting Data from a Subform to use in a button (1 Viewer)

martincabrera33

New member
Local time
Today, 19:38
Joined
Aug 23, 2020
Messages
8
Hello,
I have a similar question regarding yesterday, but this time is in a different form.
I have a form, that has a subform, and I am adding a button to the form that is getting data from the subform

@arnelgp Yesterday you taught me to use
format(Me!DateTextbox, "yyyy_mmm_dd")
To get the date of a field.

But on a subform I cant make it work.
Code:
Forms![Form].[Subform].Form![format(Me!DateTextbox, "yyyy")]

But it doesnt work. Not sure how to pull the format just to show me the year, currently if I do something like:

Code:
Forms![Form].[Subform].Form![DateTextbox]

This actually work, but not sure how to get just the year.

If somebody can help me it would be awesome.

Attached is the error I get

Thanks,
 

Attachments

  • error date.JPG
    error date.JPG
    19.2 KB · Views: 91

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:38
Joined
Aug 30, 2003
Messages
36,127
Try

format(Forms![Form].[Subform].Form![DateTextbox], "yyyy_mmm_dd")
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:38
Joined
May 7, 2009
Messages
19,247
use:

Year(Forms![Form].[Subform].Form![DateTextbox])
 

Users who are viewing this thread

Top Bottom