|
-
Feb 19th, 2010, 06:24 AM
#1
Thread Starter
Hyperactive Member
Writing to Access DB
I'm trying to write some fields into a table in an Access DB and am having a problem.
My code is as follows:
Code:
Dim cn As adodb.Connection
Dim rs As adodb.Recordset
Dim cString As String
cString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=ABC.mdb;Persist Security Info=False;"
Set cn = New adodb.Connection
cn.Open cString
Set rs = New adodb.Recordset
With rs
.Open "tbl_ABC", cn, adOpenKeyset, adLockOptimistic
.AddNew
.Fields("Field1").Value = "Test"
.Fields("Field2").Value = Now()
.Fields("Field3").Value = "abcdefghijklm.xls"
.Update
.Close
End With
For some reason it is failing on the "Field3" line with an error number -2147418105.
Can anyone help identify what I'm doing wrong ?
Thanks,
-
Feb 19th, 2010, 06:34 AM
#2
Re: Writing to Access DB
1) What is the type of the field?
2) What is the max size of that field?
3) Also check if you have spelled the field correctly
Last edited by Siddharth Rout; Feb 19th, 2010 at 06:44 AM.
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Feb 19th, 2010, 06:53 AM
#3
Re: Writing to Access DB
Also, what is the verbage of the error message? What is it telling you?
-
Feb 20th, 2010, 12:49 PM
#4
Hyperactive Member
Re: Writing to Access DB
it is because you are calling a field that have "." sequence and that is in under "" which read as a statement..
~[L!f3 !s @ll @ab0ut l3@rn!ng]~
~*D0nt Give up, h0pe is always present*~
-
Feb 21st, 2010, 06:15 AM
#5
Re: Writing to Access DB
Thread moved to 'Database Development' forum (the 'VB6' forum is only meant for questions which don't fit in more specific forums)
 Originally Posted by Condomx
it is because you are calling a field that have "." sequence and that is in under "" which read as a statement..
I don't know what you meant by that, but after comparing it to the code in post #1, I'm as sure as I can be that you are not correct.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|