Getting a type mismatch error (-2147352571 (80020005)) on this line of code
![RecievedDate] = Format(Me.txtRe cDate, "\#mm\/dd\/yyyy\#")
I can't find the error number refenced anywhere. Any hints or helps would be appriciated.
I'm using Access 2007
Here is more code: - Set rst = New ADODB.Recordset
-
-
-
rst.Open "tblOrders", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
-
-
With rst
-
.AddNew
-
![JobID] = """" & Me.txtJobID & """"
-
![JobSubID] = """" & Me.cboJobSubID & """"
-
![JobType] = """" & Me.cboJobType & """"
-
![Model] = """" & Me.cboModel & """"
-
![Lot] = """" & Me.txtLot & """"
-
Debug.Print "#" & Me.txtRecDate & "#"
-
Debug.Print Format(Me.txtRecDate, "\#mm\/dd\/yyyy\#")
-
![RecievedDate] = Format(Me.txtRecDate, "\#mm\/dd\/yyyy\#")
-
Debug.Print "after date"
-
![CustomerID] = Me.cboCustomer.Column(0)
-
.Update
-
End With
-
-
rst.Close
-
Set rst = Nothing
4 2089 ADezii 8,834
Recognized Expert Expert
Getting a type mismatch error (-2147352571 (80020005)) on this line of code
![RecievedDate] = Format(Me.txtRe cDate, "\#mm\/dd\/yyyy\#")
I can't find the error number refenced anywhere. Any hints or helps would be appriciated.
I'm using Access 2007
Here is more code: - Set rst = New ADODB.Recordset
-
-
-
rst.Open "tblOrders", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
-
-
With rst
-
.AddNew
-
![JobID] = """" & Me.txtJobID & """"
-
![JobSubID] = """" & Me.cboJobSubID & """"
-
![JobType] = """" & Me.cboJobType & """"
-
![Model] = """" & Me.cboModel & """"
-
![Lot] = """" & Me.txtLot & """"
-
Debug.Print "#" & Me.txtRecDate & "#"
-
Debug.Print Format(Me.txtRecDate, "\#mm\/dd\/yyyy\#")
-
![RecievedDate] = Format(Me.txtRecDate, "\#mm\/dd\/yyyy\#")
-
Debug.Print "after date"
-
![CustomerID] = Me.cboCustomer.Column(0)
-
.Update
-
End With
-
-
rst.Close
-
Set rst = Nothing
You are asking a Date/Time Field ([ReceivedDate] within the underlying Recordset to store the formatted value Format(Me.txtRe cDate, "\#mm\/dd\/yyyy\#") which it cannot because of the inclusion of the # characters. Either convert the [ReceivedDate] Field to Text, or reformat it as such: Format(Me.txtRe cDate, "mm/dd/yyyy"). Hope this helps.
pks00 280
Recognized Expert Contributor
Why dont u just do this, did this not work for you?
It should recognise that txtRecDate is a datefield
![RecievedDate] = Me.txtRecDate
Not sure about this
![RecievedDate] = "#" & Me.txtRecDate & "#"
or
![RecievedDate] = CDATE(Me.txtRec Date)
or long winded way
![RecievedDate] = dateserial( year(Me.txtRecD ate), month(Me.txtRec Date), day(Me.txtRecDa te))
Why dont u just do this, did this not work for you?
It should recognise that txtRecDate is a datefield
![RecievedDate] = Me.txtRecDate
your correct that did work. Thanks. I knew it was something obvious.
correct code below (for posterity) - Set rst = New ADODB.Recordset
-
-
-
rst.Open "tblOrders", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
-
With rst
-
.AddNew
-
![JobID] = Me.txtJobID
-
![JobSubID] = Me.cboJobSubID
-
![JobType] = Me.cboJobType
-
![Model] = Me.cboModel
-
![Lot] = Me.txtLot
-
![RecievedDate] = Me.txtRecDate
-
![CustomerID] = Me.cboCustomer.Column(0)
-
.Update
-
End With
-
-
rst.Close
-
Set rst = Nothing
pks00 280
Recognized Expert Contributor
Sometimes its easier than u think :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Matthew Louden |
last post by:
The following ASP code yields the following error, but actually the new
record is stored
in database. The same error happens when the application deletes a record,
such as
sqlStmt ="delete from test where username='2323'" Any ideas? Thanks!
<%
Dim objRS, sqlStmt
Set objRS = Server.CreateObject ("ADODB.Recordset")
sqlStmt = "insert into...
|
by: Dalan |
last post by:
I'm experiencing a Query Syntax Error with an Access 97 Db. Actually,
the query performs as expected when adding any new records or editing
existing ones and even deleting records, EXCEPT when the last record
on any related subform is deleted, then it generates a Runtime Error
3075 - Syntax error (missing operator) in query expression 'IDRef =...
|
by: Steve Jorgensen |
last post by:
When writing VB or VBA code that works with databases or other external
libraries that cannot be trusted to automatically do the right thing when
references to their objects are arbitrarily released, some thought must be put
into how to make sure the objects will all be closed and released in the
correct order, even in the result of an error....
|
by: Nathan Bloomfield |
last post by:
Hi there,
I am having difficulty with a piece of code which would work wonders
for my application if only the error trapping worked properly.
Basically, it works as follows:
- adds records from rsSource into rsDest
- if it finds a key violation then it deletes the current record from
rsDest and adds the new record from rsSource. This...
|
by: astro |
last post by:
Anyone have suggestions on where to troubleshoot this error?
Background:
-Access 2k v. 9.0.6926 sp3
- front and backend on production server (wiindows 2k)
-accessed via Citrix
-front-end is mde, backend is mdb
-only occurs on the production server
-only occurs with mde verson - i've tested the problem with the mdb version
of the...
| |
by: TD |
last post by:
This is the code under a command button -
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.BackColor <> RGB(255, 255, 255) Then
ctl.BackColor = RGB(255, 255, 255)
End If
Next ctl
|
by: Kosmös Pollard |
last post by:
Hey guys, I'm rather new to access and can not seem to figure out what
is wrong with this code I will post below...but first...it was working
perfectly fine before I added this:
recSet2.Edit
recSet2.Fields("DateDifference") = UntilCompletion
recSet2.Update
As was suggested by a helpful friend at TheScripts
|
by: amatuer |
last post by:
ADODB.Recordset error '800a0cb3'
Current Recordset does not support updating. This may be a limitation
of the provider, or of the selected locktype.
/devag/newProjSave.asp, line 321
sqlOCF = "SELECT * FROM DA_OtherCFacilities"
set rstOCF = CreateObject("ADODB.Recordset")
|
by: breadhead |
last post by:
Good morning, all.
I am creating an Access 2002 application to run on XP clients and I'm struggling with the task of testing whether a single-field record exists before allowing the user to add it to a look up table. I considered creating a unique index on the field in the table, but the users here would not know how to handle the error...
|
by: morrisqueto |
last post by:
Hello,
One of my websites just started sending a new rare error. The site has been working for almost 2 years without trouble, but today morning started giving away this error in all my views.
Microsoft VBScript runtime error '800a01fb'
An exception occurred: 'MoveNext'
/test.asp, line 544
Here is the code:
|
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...
| |
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. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |