Here's a poser! Using Access 2003 SP2
The Control Source for txtMealDate is defined at table level as Date/Time.
When this code is run - Private Sub txtMealDate_AfterUpdate()
-
txtMealDate.DefaultValue = DateAdd("d", 1, Me.txtMealDate)
-
MsgBox txtMealDate.DefaultValue
-
End Sub
the messagebox pops up with the correct DefaultValue. But when I move to a new record, the date entered as default is 12/30/1899. I've deleted the form and re-created it , as well as the table. I've been taking cold medicines that have me kind of spacey, so I figure it's got to be something simple I'm overlooking. I'd appreciate any ideas, as my hair is already sparse and I'm pulling out more by the minute!
Linq ;0)>
8 3208
Hello, Linq.
TextBox.DefaultValue property is of String type and date delimiters (#) should be added to a string value assigned to it.
Regards,
Fish.
P.S. Where did you get such a powerful medcine? ;)
Over the county!
Tried that! Tried wrapping it in CDate() as well.
Linq ;0)>
Over the county!
Tried that! Tried wrapping it in CDate() as well.
Linq ;0)>
:)
I guess that means doesn't work.
But it does.
TextBox.DefaultValue is String type property.
(BTW, though I didn't check it personally, but it most like that date should be formatted like when displayed in that particular Textbox control)
Being such it gets and returns String type values.
Date delimiters, "#", has to be included in the string value assigned to the property.
txb.DefaultValue = "#" & dteVariable & "#"
P.S. What is an API (Active Pharmaceutical Ingridient LOL) of the medcine you've taken? :D
As I said, I tried wrapping it in the # delimiter, like you would if you were doing a hack tp simply carry a value forward, but couldn't get it to work. Like a dummy (or maybe a 'doped') I neglected to wrap the pound mark in quotes! This does it: - Private Sub txtMealDate_BeforeUpdate(Cancel As Integer)
-
txtMealDate.DefaultValue = "#" & DateAdd("d", 1, Me.txtMealDate) & "#"
-
End Sub
Thanks for your help, Fish!
Linq ;0)>
BTW, the magic elixir is CODEINE!
Thanks for your help, Fish!
Linq ;0)>
You are most welcome. :)
BTW, the magic elixir is CODEINE!
I would prefer Jagermeister - a magic of the Light Side. :D
Egads! Took Jagermeister on a camping trip once, my camping mates said I was actually howling at the moon before the the night was thru!
Linq ;0)>
NeoPa 32,556
Expert Mod 16PB
Hi guys.
Late to the party it seems, but I'm glad to see that Fish has helped you to resolve the issue Linq :)
12/30/1899 (or 30/12/1899 for Euros) is actually the date representation of 0 (not -1 as I'd anticipated. Why it starts before the beginning of the new century is a mystery to me).
I'm surprised a simple CDate() return value wouldn't work mind you.
I was too, Ade, but as John Walton used to say "Life's a mystery!"
;0)>
Sign in to post your reply or Sign up for a free account.
Similar topics
by: lofty |
last post by:
Dear Lord,
I'm trying to code a drop down for a date entry that gives
the user the option of the current date plus the dates of
the last 7 days.
<%
for i = -7 to -1
Response.write...
|
by: Jon |
last post by:
Hi,
I am trying to pick up records from a date range without much luck. For my
example below I am trying to pick up all records made in the last month.
However none are being found (my code is...
|
by: Lauren Quantrell |
last post by:
I have a stored procedure using Convert where the exact same Convert
string works in the SELECT portion of the procedure but fails in the
WHERE portion.
The entire SP is listed below....
|
by: Raghu |
last post by:
Hello...
I am running into a problem while running a query..can some1 help..
this is the query :
**************
SELECT *
from Table S
where S.dtDate1 BETWEEN...
|
by: Mark Reed |
last post by:
Hi Guru's,
I have created a database to monitor hours I have worked as our payroll
department are so crap. I work nights most of the time but occasionally I
have to work on days. Between the hours...
|
by: Annette Massie |
last post by:
I am trying to insert a record into a table via code and one of the
values to add I would like as a dateadd calculation on a value from a
query.
My code looks like this:
Set db = CurrentDb() ...
|
by: Drum2001 |
last post by:
I have a report that acts as a time sheet for employees. It lists
there "punch-in" and "punch-out and catagorizes them by week, with
different totals..
At the end of each week is a total of all...
|
by: noone |
last post by:
Hi,
I am designing an application which displays news topics until midnight
on the DisplayUntil date and then they should drop out. Unfortunately,
they seem to be dropping out at mid-day.
I'm...
|
by: ncsthbell |
last post by:
I am having problems getting the end date to calculate correctly.
I start with Quarter '03/02', (YY/QTR), for this it means it is for the 2nd qtr of 2003. My goal is to get the begin & end dates...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |