473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

insert short date

abouddan
Hi all
I am trying to insert in my table "Table1" a new record.
This table contains a field "cDate". When using a form to insert in that table the textbox "txtDate' is filled automaticly (row source= date(now) ) and in its format I put "Short Date". The display is very good but when inserting to the table the date field is not short date, it's just as we put in row source "=Now".
So I tryied to change the propreties of that field from the table desin view to be "short date" and it's input mask to be "99/99/9999" but same result.
So how can insert in the table a short date?
May 2 '07 #1
7 4330
Any Help?

10x
May 3 '07 #2
hi!!!
well try changing ur regional and language settings in control panel...
this will help u i guess
May 3 '07 #3
hi!!!
well try changing ur regional and language settings in control panel...
this will help u i guess
Thanks for the reply
But I am thinking about implementing this programm in another PC, is it logic to change the settings for all who will implement it?
Another thing let's say we did what you just said, If someone in the future changes by misstake this setting, this code become unusful. So I think there is something else.

Thanks
May 3 '07 #4
Rabbit
12,516 Expert Mod 8TB
Hi all
I am trying to insert in my table "Table1" a new record.
This table contains a field "cDate". When using a form to insert in that table the textbox "txtDate' is filled automaticly (row source= date(now) ) and in its format I put "Short Date". The display is very good but when inserting to the table the date field is not short date, it's just as we put in row source "=Now".
So I tryied to change the propreties of that field from the table desin view to be "short date" and it's input mask to be "99/99/9999" but same result.
So how can insert in the table a short date?
A textbox doesn't have a row source. Are you talking about control source? The control source is what tells the control where to save it's data. By setting it to date(now) it won't save anywhere. You have to set the control source to the field and set the default value to your expression. Or you have to do it through code.

Also, CDate is a function in Access, I recommend you rename it as it may cause problems later.
May 3 '07 #5
A textbox doesn't have a row source. Are you talking about control source? The control source is what tells the control where to save it's data. By setting it to date(now) it won't save anywhere. You have to set the control source to the field and set the default value to your expression. Or you have to do it through code.

Also, CDate is a function in Access, I recommend you rename it as it may cause problems later.

Thanks for your Advice I will change it.
I mean control source not row source, My mistake. Yes I know it won't save by itself, I am doing it by code when clicking on a button.

What do you mean by "You have to set the control source to the field and set the default value to your expression"
May 4 '07 #6
pks00
280 Expert 100+
The controlsource should be set to the fieldname thats in your table. That way u ensure that textbox is bounded to that field. Any changes u make then are reflected in that textbox.

Now I assume you want this for new records, have a default date of Now()

You can do this one of two ways

in table design, u can set the default value to be Now() so that way no coding is required
or you can set the Default Value of the field (its a property itself) to Now()

Note Now returns both date/time. If u just want a date, use Date() or Format(Now(),"Short Date")
May 4 '07 #7
The controlsource should be set to the fieldname thats in your table. That way u ensure that textbox is bounded to that field. Any changes u make then are reflected in that textbox.

Now I assume you want this for new records, have a default date of Now()

You can do this one of two ways

in table design, u can set the default value to be Now() so that way no coding is required
or you can set the Default Value of the field (its a property itself) to Now()

Note Now returns both date/time. If u just want a date, use Date() or Format(Now(),"Short Date")

I did what you said but when quering the table the final result is as I put Now() like I discribe in my first post.
May 4 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: jason | last post by:
I'm tearing out my hair here: ACCESS 2000: When I attempt to overwrite a date in my date field with a new user selected valid date eg: 05/23/99 my date field changes to the TIME I updated the...
1
by: Dark | last post by:
Im trying to insert a clob into the database and I get the following error. DBD::DB2::st execute failed: SQL0804N The application program input parameters for the current request are not...
3
by: os2 | last post by:
hi i have an insertion problem with my rtu table datatype for date1 field is: datetime i try to insert local date to the database (mysql) source code struct tm *date;
3
by: Bon | last post by:
Dear all How can I convert a datetime in Short Date format to General Date format and then insert into SQL database? I get a date from a field using Request("in_date"), which is in Short...
3
by: Me | last post by:
Trying to get the current status of the insert key. Found my.computer.keyboard.capslock, but no such item for insert key. Anyone have some code to help. Can't figure out getkeystate. compiler...
4
by: PerumalSamy | last post by:
Hi, i am doing program in asp.net using vb coding and MS Access as back end. i am having a table with date field and manipulation is based on the same. i am inserting value from textbox...
3
by: Matt Brown - identify | last post by:
Hello, I'm trying to figure out a method to look up by a range of dates, entries in a database. The format of the date in the database is "M\D \yyyy HH:MM:SS". What i need to do is take the...
0
by: mwenz | last post by:
I am trying to update an Access table using OLEDB in VB.Net 2005. I can add rows but I cannot update them. Code to instantiate the Access database and table... Dim conn As New...
1
by: billa856 | last post by:
Hi, I am trying to insert Null value in column(ShipDate) in my table.That column(ShipDate)'s type id date/time and format is short date. I am using "" to insert Null in that column(ShipDate)...
0
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,...
0
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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.