Reputation: 117
Using access 2010 on an access 2003 database.
I have a form with an unbound data field. A button calls vba, which calls a macro. The macro calls a query, which references the form data field [Forms]![my form]![my field]. Not actually called those things but just to explain it.
The vba code can see the form data field. Debug print prints it out. The query returns a blank.
I verified this with creating a new query that just lists out the table rows from a random table and also the [Forms]![my form]![my field]. I even verified it by changing the name, which makes the query prompt me for the data, and referencing another field.
This was happening yesterday on another form/query, but after messing with it, suddenly it started working. I'd compressed/fixed the database, added a replacement unbound data field, changed the data format from short date with datepicker to general date to just blank for the format. I'm still not sure why it suddenly started working.
But now it's happening on this other form and query, and I have no idea why.
I wasn't even editing the form when it started happening. Yesterday this form worked fine.
Any ideas why this could be happening? I might be able to keep fixing it, possibly, but it's not a good thing to have queries mysteriously stop working because the form field suddenly starts returning blanks.
Upvotes: 0
Views: 2142
Reputation: 4312
I hate to put this as an answer because it is still a work-in-progress, but I can't fit my response into a comment box.
I did as you suggested (kinda):
Then decided to modify the query to return the date as follows:
Expr3: Format([Forms]![Form4]![Text0],"mm/dd/yyyy")
And everything is now fine (until it breaks again? Maybe?
Upvotes: 1