Setting Control Source to =Date() Win10 Access 2003

timitfc

New member
Local time
Today, 14:35
Joined
Jun 28, 2016
Messages
7
Good Morning,

I have an old Access 2003 DB that im trying to access on a new Windows 10 machine.

Most forms are working completely fine apart from one that has textboxes with the controlsource set to =Date()-7, =date()=6, through to =Date(). The issue is these are not working. I opened the design form and the controlsource is "". When i try to manually set this i get the following error message:

"The Function you entered can't be used in this expression"

I tested the file on both a Windows 7 machine and another Win 10 Machine. Just wondering if anyone had any ideas?

Many Thanks!
 
another alternative is to set the values of the textbox while the Form is Loading:


Private Sub Form_Load()
Me.text1=Date()-7
Me.text2=Date()-6
Me.text3=Date()
End Sub
 
...I opened the design form and the controlsource is "". When i try to manually set this i get the following error message:

"The Function you entered can't be used in this expression"
You're saying that when you try to replace the Zero-Length String ("") in the Control Source with the desired data, i.e.

=Date()-7

and so forth, that you then get this error?

another alternative is to set the values of the textbox while the Form is Loading:

Private Sub Form_Load()
Me.text1=Date()-7
Me.text2=Date()-6
Me.text3=Date()
End Sub

Doing this in the Form_Load event will only assign these values for the first Record displayed, when the Form opens.

You could, however, use this code in the OnCurrent event.

Linq ;0)>
 
Thanks for the replies - in regards to ArnelGP's solution, this will work as it is a static page that is loading - the idea is to show cashflow for the current monthly period ( see link https:// prnt.sc/h59tzw )

I have just coded this to work on Form Load and it is working, however my concern is to why using this on this one PC is bringing up the error message.

Thanks
 
he setting it as control source, so it is unbound.
 
Ok so i think i have found the issue with the whole thing... i found that changing the Controlsource from =Date()+7 to being unbound and then set on Form_load worked great.

However, i then ran into another error when trying to use =Date() in a query- "Function is not available in your expressions in query".

I stumbled upon the solution below:

"One of the libraries that was checked (Microsoft ActiveX Data Objects 2.5), had a couple of 'newer' versions. So i changed the reference from 2.5 to 2.8, and i dont get the error anymore. And all the functions are working correctly."

I did check for missing references but because it didnt say "MISSING:" i didnt think anythong of it. Anyway, thanks to your suggestions!
 

Users who are viewing this thread

Back
Top Bottom