473,666 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

insert short date

abouddan
42 New Member
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 4344
abouddan
42 New Member
Any Help?

10x
May 3 '07 #2
Toral Shah
19 New Member
hi!!!
well try changing ur regional and language settings in control panel...
this will help u i guess
May 3 '07 #3
abouddan
42 New Member
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 Recognized Expert Moderator MVP
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
abouddan
42 New Member
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 Recognized Expert Contributor
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(),"S hort Date")
May 4 '07 #7
abouddan
42 New Member
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(),"S hort 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
2201
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 field and does not display my desired date: 05/23/99 Instead it reads: 12:12:03 AM I am going nuts - even considering converting the field to text. The field
1
4900
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 valid. Reason code "103". If a host variable or S QLVAR in the SQLDA is invalid then: host variable/SQLVAR number = "5", SQLTYPE = "393", SQLLEN = "33", host variable/SQLVAR type = "INPUT". SQLSTATE=07002
3
2563
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
16376
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 Date format. Afterwards, I need to convert it into General Date and then insert the date into database. But, the date is always inserted as 1/1/1900. Please give me some suggestions.
3
5827
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 chokes on rslt = getkeystate(keys.insert) ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
4
2009
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 using sql query as follows ex: Textbox1.text="10-04-2007" (ie. in dd-MM-yyyy format)
3
2222
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 dates that are in the database (formatted as above), isolate the date (which is in short format) and compare it to the short formatted date in a datetimepicker.
0
3969
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 OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db.Name) conn.Open() Dim oda As New OleDb.OleDbDataAdapter("select " & sqlCols & " from ;", conn) Dim cb As New OleDb.OleDbCommandBuilder(oda) cb.QuotePrefix = "" oda.UpdateCommand =...
1
3756
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) but it shows warning that customer can't append all the records in the append query. Customer set 1 field(s) to Null due to a type conersion failure,and it didn't add 0 record(s) to the table due to key violation, 0 record(s) due to lock...
0
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.