Using textbox from form for query field

jalopez453

Registered User.
Local time
Today, 14:21
Joined
Oct 11, 2016
Messages
18
I have been googling a solution for this and have had no luck. I am trying to use a textbox from a form as the value of query field.

I have my field as below but my table returns nothings.

my field in my query is as below.

Field: Start Date: [Forms]![frmMain]![txtStartDate]


Thank you.
 
That looks right. Are you sure there's a date in the table equal to the date you are putting in the textbox. You could try some variations and see what happens

>[Forms]![frmMain]![txtStartDate]

should give you all the dates greater than the date in the textbox or

<[Forms]![frmMain]![txtStartDate]

should result in records with dates less than.

If you upload your database I'll see if figure out what's wrong.
 
I would but due to PHI, I am unable to upload the database. It seems to be working, reason why is because when I run my Report Form it populates the dates in the header field and I reference the query fields to the textbox in the Report Form. for some reason it does not populate it on the query records.

I attached an image of my query results, query fields, and Report header. As you can see in the header it has the dates but the query fields do not.
 

Attachments

  • AccessExample1.JPG
    AccessExample1.JPG
    35.3 KB · Views: 123
You're not going to believe this, but I just figured it out.
All I needed was to add a format.


Field: Start Date: Format([Forms]![frmMain]![txtStartDate],"m/d/yyyy")

Something so simple that makes a big difference! hahaha
Thanks again for your help!
 
Oh sorry I misread your post I though this was about criteria. Sometimes when I've used form references in expressions they don't show up unless converted to a string. I suggest trying:
Code:
 Start Date: [COLOR="Blue"]CStr([/COLOR][Forms]![frmMain]![txtStartDate][COLOR="blue"])[/COLOR]
 
You're not going to believe this, but I just figured it out.
All I needed was to add a format.


Field: Start Date: Format([Forms]![frmMain]![txtStartDate],"m/d/yyyy")

Something so simple that makes a big difference! hahaha
Thanks again for your help!

Ok that would convert it to a string too.
 

Users who are viewing this thread

Back
Top Bottom