473,568 Members | 2,850 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADO error adding to recordset

34 New Member
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:

Expand|Select|Wrap|Line Numbers
  1.     Set rst = New ADODB.Recordset
  2.  
  3.  
  4.     rst.Open "tblOrders", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
  5.  
  6.     With rst
  7.         .AddNew
  8.         ![JobID] = """" & Me.txtJobID & """"
  9.         ![JobSubID] = """" & Me.cboJobSubID & """"
  10.         ![JobType] = """" & Me.cboJobType & """"
  11.         ![Model] = """" & Me.cboModel & """"
  12.         ![Lot] = """" & Me.txtLot & """"
  13.         Debug.Print "#" & Me.txtRecDate & "#"
  14.         Debug.Print Format(Me.txtRecDate, "\#mm\/dd\/yyyy\#")
  15.         ![RecievedDate] = Format(Me.txtRecDate, "\#mm\/dd\/yyyy\#")
  16.         Debug.Print "after date"
  17.         ![CustomerID] = Me.cboCustomer.Column(0)
  18.         .Update
  19.     End With
  20.  
  21.     rst.Close
  22.     Set rst = Nothing
Apr 17 '07 #1
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:

Expand|Select|Wrap|Line Numbers
  1.     Set rst = New ADODB.Recordset
  2.  
  3.  
  4.     rst.Open "tblOrders", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
  5.  
  6.     With rst
  7.         .AddNew
  8.         ![JobID] = """" & Me.txtJobID & """"
  9.         ![JobSubID] = """" & Me.cboJobSubID & """"
  10.         ![JobType] = """" & Me.cboJobType & """"
  11.         ![Model] = """" & Me.cboModel & """"
  12.         ![Lot] = """" & Me.txtLot & """"
  13.         Debug.Print "#" & Me.txtRecDate & "#"
  14.         Debug.Print Format(Me.txtRecDate, "\#mm\/dd\/yyyy\#")
  15.         ![RecievedDate] = Format(Me.txtRecDate, "\#mm\/dd\/yyyy\#")
  16.         Debug.Print "after date"
  17.         ![CustomerID] = Me.cboCustomer.Column(0)
  18.         .Update
  19.     End With
  20.  
  21.     rst.Close
  22.     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.
Apr 18 '07 #2
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))
Apr 18 '07 #3
Tetelestai
34 New Member
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)

Expand|Select|Wrap|Line Numbers
  1.     Set rst = New ADODB.Recordset
  2.  
  3.  
  4.     rst.Open "tblOrders", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
  5.     With rst
  6.         .AddNew
  7.         ![JobID] = Me.txtJobID
  8.         ![JobSubID] = Me.cboJobSubID
  9.         ![JobType] = Me.cboJobType
  10.         ![Model] = Me.cboModel
  11.         ![Lot] = Me.txtLot
  12.         ![RecievedDate] = Me.txtRecDate
  13.         ![CustomerID] = Me.cboCustomer.Column(0)
  14.         .Update
  15.     End With
  16.  
  17.     rst.Close
  18.     Set rst = Nothing
Apr 18 '07 #4
pks00
280 Recognized Expert Contributor
Sometimes its easier than u think :)
Apr 18 '07 #5

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

Similar topics

6
46874
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...
1
2185
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 =...
2
3005
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....
3
6875
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...
7
7234
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...
16
7203
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
1
2896
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
3
616
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")
4
2042
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...
1
3800
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:
0
7693
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...
0
7916
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. ...
0
8117
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7660
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...
0
7962
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...
0
6275
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...
0
3651
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...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
932
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...

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.