I have a table with 3 fields: UnitTime, Unit, and UnitCount
in an MDB database.
I have a query, qryWriteUnitOccupancy, that appends a record
to that table using 2 parameters: TimePoint, and PointUnit
I am using the following code to write a record:
For dUnitHour = FromDate To ToDate Step 1 / 24
With cmdUnit
.ActiveConnection = cnnUnit
.CommandType = adCmdText
.CommandText = "execute qryWriteUnitOccupancy"
Set prmUnit = .CreateParameter("TimePoint",
adDBTimeStamp, adParamInput, , Format(dUnitHour, "mm/dd/yyyy
hh:nn"))
.Parameters.Append prmUnit
Set prmUnit = .CreateParameter("PointUnit", adChar,
adParamInput, 5, sUnit)
.Parameters.Append prmUnit
.Execute
End With
Next dUnitHour
I run this, and no matter what the time is in dUnitHour, it
gets written to the table as a truncated date (no time). I
have stepped through this and watched the value of dUnitHour
step through hours, and I have run the query directly,
passing date/time and unit, and it writes just fine.
Any ideas?
Thanks,
Kevin Nechodom
University of Utah 2 4382
Try adDate, rather than adDBTimeStamp. They're not the same thing, and
AFAIK, Access doesn't support adDBTimeStamp.
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no e-mails, please!)
"Kevin Nechodom" <Ke************@nospamhsc.utah.edu> wrote in message
news:d4**********@vegh.ks.cc.utah.edu... I have a table with 3 fields: UnitTime, Unit, and UnitCount in an MDB database.
I have a query, qryWriteUnitOccupancy, that appends a record to that table using 2 parameters: TimePoint, and PointUnit
I am using the following code to write a record: For dUnitHour = FromDate To ToDate Step 1 / 24 With cmdUnit .ActiveConnection = cnnUnit .CommandType = adCmdText .CommandText = "execute qryWriteUnitOccupancy" Set prmUnit = .CreateParameter("TimePoint", adDBTimeStamp, adParamInput, , Format(dUnitHour, "mm/dd/yyyy hh:nn")) .Parameters.Append prmUnit Set prmUnit = .CreateParameter("PointUnit", adChar, adParamInput, 5, sUnit) .Parameters.Append prmUnit .Execute End With Next dUnitHour
I run this, and no matter what the time is in dUnitHour, it gets written to the table as a truncated date (no time). I have stepped through this and watched the value of dUnitHour step through hours, and I have run the query directly, passing date/time and unit, and it writes just fine.
Any ideas?
Thanks,
Kevin Nechodom University of Utah
I wasn't aware of the limitations of adDBTimeStamp usage on
Access queries. Learn something new! Anyway, the problem
was the fact that I was trying to reuse an ADODB.Command
object in a loop, and it just spit out the same thing every
time!
Thanks!
Kevin Douglas J. Steele<NOSPAM_djsteele@NOSPAM_canada.com>
4/25/2005 6:53:25 PM >>>Try adDate, rather than adDBTimeStamp. They're not the
samething, and AFAIK, Access doesn't support adDBTimeStamp.
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Kevin Nechodom" <Ke************@nospamhsc.utah.edu> wrote in message news:d4**********@vegh.ks.cc.utah.edu...I have a table with 3 fields: UnitTime, Unit, andUnitCount in an MDB database.
I have a query, qryWriteUnitOccupancy, that appends a record to that table using 2 parameters: TimePoint, and PointUnit I am using the following code to write a record: For dUnitHour = FromDate To ToDate Step 1 / 24 With cmdUnit .ActiveConnection = cnnUnit .CommandType = adCmdText .CommandText = "execute qryWriteUnitOccupancy" Set prmUnit = .CreateParameter("TimePoint", adDBTimeStamp, adParamInput, , Format(dUnitHour,
"mm/dd/yyyy hh:nn")) .Parameters.Append prmUnit Set prmUnit = .CreateParameter("PointUnit", adChar, adParamInput, 5, sUnit) .Parameters.Append prmUnit .Execute End With Next dUnitHour
I run this, and no matter what the time is in dUnitHour, it gets written to the table as a truncated date (no time).
I have stepped through this and watched the value of dUnitHour step through hours, and I have run the query directly, passing date/time and unit, and it writes just fine.
Any ideas?
Thanks,
Kevin Nechodom University of Utah This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
...
|
by: Kenneth |
last post by:
I have a Query that consist of a lot of different sales data, and one of the
colums are different date. The date goes from 1jan2003 til 31jan2003. in
this Query I only want the salesdata for...
|
by: Tony |
last post by:
Hey guys,
I use Google Groups quite a bit as it is an enormous wealth of
information, and now I need some help. I have created a query using
parameters to capture a range of date, the date is...
|
by: Julie Wardlow |
last post by:
Help!
I am calculating a future date using the DateAdd function in a query (the
calculation also involves an IIf statement), and have managed to get this
formula to produce the required result....
|
by: |
last post by:
Hi,
I've defined an ObjectDataSource and a parameterized DataSet. I would like
it if I could pass the parameter value that describes the query that creates
the DataSet as part of a user control...
|
by: bbdobuddy |
last post by:
Hi,
I have an ASP.net application with a connection to a sql database. I am
writing a SQL statement to update some fields in a table but it won't run
because it gives me an error that says
...
|
by: jeff |
last post by:
i have written a program with date format as m/d/yyyy
when i deploy it to client's machine, due to the client use d/m/yyyy format
the Select SQL statement return some record wrongly.
how can i...
|
by: eric.goforth |
last post by:
Hello,
I'm trying to convert a string to a date time in a C# web service.
I'm passing in a string parameter and I have a localization setting in
my Web.config file:
My app is blowing up on...
|
by: MaartenVR |
last post by:
sub: MS SQL server and (missing) ANSI DATE-datatype
I’m working at a company who has developed a large client/server application in Delphi 6, with Interbase as the DB-server (both Borland...
|
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,...
|
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...
|
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...
|
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,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |