How to make date from unbound form in access be recognized in any runtime environment (3 Viewers)

nector

Member
Local time
Today, 11:58
Joined
Jan 21, 2020
Messages
537
I have just encountered a problem in access runtime environment; I have created an unbound access form specifically to aid users to select dates required for a parameterized report, this form work very well in in full version of Access and is able to recognize the dates but fail to recognize the same dates in Access runtime environment.

Is there a way to sort out this?

I have chosen all the date controls to short date see the picture but still nothing works any idea to sort out this.


Untitled.png
 
Is there a way to sort out this?
Please show the code that fails.

The most common cause of such problems is when dates are passed on as text and not in Date/Time typed variables.
 
Here is what happens when you enter the date using a date picker, see the picture below: this only happen in Access runtime NOT full version

1755676216555.jpeg
 
Is there a Validation Rule defined for the control in the form?
Does this Validation Rule expect the date to be in a specific format?
 
Is the Access runtime running on a different machine? Does the different machine have different regional settings for date formats? Can you enter a date directly that works? On the machine that works, rename the working file extension to .accdr. Run it. It will open in runtime mode. Does it work?
 
Is the Access runtime running on a different machine? Does the different machine have different regional settings for date formats? Can you enter a date directly that works? On the machine that works, rename the working file extension to .accdr. Run it. It will open in runtime mode. Does it work?

To answer your question, it seems like you to say I use this method below which also works in full version Access I do not in runtime:

Code:
Private Sub txtPosCashEndDate_AfterUpdate()
Me.txtPosCashEndDate = Format((Me.txtPosCashEndDate), "YYYY\/MM\/DD")
End Sub

Private Sub txtPosCashStartDate_AfterUpdate()
Me.txtPosCashStartDate = Format((Me.txtPosCashStartDate), "YYYY\/MM\/DD")
End Sub
 
Here is what happens when you enter the date using a date picker, see the picture below: this only happen in Access runtime NOT full version

View attachment 121170


See the new code I'm have just put


Code:
Private Sub txtPosCashEndDate_AfterUpdate()
Me.txtPosCashEndDate = Format((Me.txtPosCashEndDate), "YYYY\/MM\/DD")
End Sub

Private Sub txtPosCashStartDate_AfterUpdate()
Me.txtPosCashStartDate = Format((Me.txtPosCashStartDate), "YYYY\/MM\/DD")
End Sub

1755679075632.png


This works well in full version , but runtime I will try it tomoroww
 
No validation rule at all
Well, you created an indirect validation rule with your VBA code in combination with the Short Date format of the controls...

Me.txtPosCashEndDate = Format((Me.txtPosCashEndDate), "YYYY\/MM\/DD")
Here you force YYYY/MM/DD as date format, which might not be a valid date format on the target (runtime) computer. - And, actually, I don't think YYYY/MM/DD is a valid date format anywhere. It might just be "tolerated" on your main computer.

Either use this instead:
Code:
Me.txtPosCashEndDate = Format((Me.txtPosCashEndDate), "Short Date")

Or remove the shown VBA code altogether. I cannot see any meaningful purpose it could have.
 

Users who are viewing this thread

Back
Top Bottom