Hi,
I was trying to blank out (null out?) a field of a record that is a
date/time data type. Here is code excerpt:
Dim D As Database
Dim rsRacks As Recordset
Dim strSQL As String
strSQL = "SELECT Racks.* FROM Racks WHERE (((Racks.[RL-Serial])= "
& RackSerial & "));"
Set D = CurrentDb
Set rsRacks = D.OpenRecordset (strSQL, DB_OPEN_DYNASET )
If rsRacks.RecordC ount > 0 Then
rsRacks.Edit
rsRacks![DateShipped] = ""
rsRacks![TimeShipped] = ""
Else
rsRacks.AddNew
rsRacks![RL-Serial] = RackSerial
End If
rsRacks.Update
rsRacks.Close
This code gets a type conversion error. The problem lines is where the
DateShipped and TimeShipped are set to "". I also tried "##". Does
anyone have any ideas?
Thanks in advance,
Aaron 1 2833
Try using Null. Of course, that will only work if the field is marked as not
being required.
If is required, Date fields are actually numbers (8 byte floating point
numbers, where the integer part represents the date as the number of days
related to 30 Dec, 1899, and the decimal part represents the time as a
fraction of a day). You'd have to set the fields to a numeric value,
preferably one that can't occur naturally!
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no e-mails, please!)
<ha***********@ hotmail.com> wrote in message
news:11******** ************@o1 3g2000cwo.googl egroups.com... Hi,
I was trying to blank out (null out?) a field of a record that is a date/time data type. Here is code excerpt:
Dim D As Database Dim rsRacks As Recordset Dim strSQL As String
strSQL = "SELECT Racks.* FROM Racks WHERE (((Racks.[RL-Serial])= " & RackSerial & "));" Set D = CurrentDb Set rsRacks = D.OpenRecordset (strSQL, DB_OPEN_DYNASET )
If rsRacks.RecordC ount > 0 Then rsRacks.Edit rsRacks![DateShipped] = "" rsRacks![TimeShipped] = "" Else rsRacks.AddNew rsRacks![RL-Serial] = RackSerial End If
rsRacks.Update rsRacks.Close
This code gets a type conversion error. The problem lines is where the DateShipped and TimeShipped are set to "". I also tried "##". Does anyone have any ideas?
Thanks in advance, Aaron This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe Scully |
last post by:
Hi all,
I am having trouble with access adding a blank record to a subform
everytime I finish entering data and closing the form. (The form and
subform are based on the one table)
When entering data into the subform I get the pencil icon to show data
addition, but underneath the record I am inputting data the record is
blank with a star(*)icon and this is the record(blank)that always gets
saved with all the records that actually have...
|
by: Javier |
last post by:
I have a field type Date/Time that automatically defaults to Now().
I'm having a problem writing a query that will retrieve all the
records for a specific date the user to enters when prompted. I could
retrieve all the records for a specific date if I hard-code the date
into the query, but not if I want to prompt the user. Has anybody
else experienced this? Does anybody have any suggestions?
|
by: MacDermott |
last post by:
I have a query, which gathers up information, which is subsequently dumped
into an instance of Excel using recordsetcopy.
For one of the query fields, I have written what should be a pretty simple
little function with three arguments, a switch (integer) and 2 date fields.
For certain values of the switch, I use one date field, for others, the
other date field, and for switch values which are neither, I need to return
a blank.
Well,...
|
by: Dixie |
last post by:
How can I programatically, take some Date/Time fields present in a table in
the current database and change their type to text?
dixie
|
by: Øyvind Isaksen |
last post by:
I have a page with an optional integer-field, and one asp:calendar control.
I use a stored procedure to save the data in SQL Server.
When all fields contains data, the code works great! But if the user dont
fill in the optional "price-field" (integer value), or if the user dont
choose a date in the asp:calendar control, I get the message "Input string
was not in a correct format".
How do I save "Null" value if the price-field is blank,...
| |
by: Rick |
last post by:
I'm trying to do a SELECT statement looking for a DATE_COMPLETED field which
is blank, meaning it has not been completed. The DATE_COMPLETED field is a
DATE type field. How do I specify my WHERE conditiion to restrict the
results to only those records which have no DATE_COMPLETED data in them?
Thanks in advance,
Rick
|
by: sparks |
last post by:
I am trying to fix a database that someone did about 4 yrs ago in
access97.
The main table just contains demographics and is on the main form of
the database.
It has a subform on a tab that contains the other information.
it is set 1 to 1 in the relationships.
simplify if I can
|
by: M Skabialka |
last post by:
I am creating my first Visual Studio project, an inventory database. I have
created a form and used written directions to add data from a table to the
form using table adapters, data sets, etc.
I imported a table from an Access database which has some date fields. Many
of these dates have never been filled in, so are nulls. If I look directly
into the table data from Visual Studio it shows NULL.
However, when I scroll from record to...
|
by: dympna |
last post by:
Hi can anyone suggest a fix for this... as I am a novice in access.
I have created a training table with the following fields
Employee Name - joe
Training Received - Fork lift
Date Received - 20/6/07
Certificate - yes
What I want to create is a renewal date for this training, there are
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |