Sign in to follow this  
Followers 0
Floppy

Writing table and data to MS Access database!

21 posts in this topic

Hello,

Can someone help me figuring out how to create a MS Access database, and creating tables and data into it, please?

I found this UDF but it's very old and gives me some errors.

Thank you and bye

Share this post


Link to post
Share on other sites



Last modified: Sunday, May 01, 2011 -- it's not soo old...

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yes, but it gives me an error

Access.au3 line 291

The requested action with this object has failed.:
$oADO.Execute ("CREATE TABLE " & $adTable & '(' & $F_Out & ')')
$oADO.Execute ("CREATE TABLE " & $adTable & '(' & $F_Out & ')')^ ERROR

How can I do?

Edited by FSoft

Share this post


Link to post
Share on other sites

Do you have Access installed?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

No. Do I need it? If so, which version?

Share this post


Link to post
Share on other sites

FSoft,

That last post is worth this at the very least! :)

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

How can I use ADODB?

Share this post


Link to post
Share on other sites

Can someone teach me how to use ADODB? Thanks! :)

Share this post


Link to post
Share on other sites

Search the forum for ADODB and you will find what you need!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

ADODB is just like a driver component which always needs an actual (ADO compatible) DB engine behind the scene.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

FSoft,

That last post is worth this at the very least! :)

M23

I don't understand anything of this?!?

Search the forum for ADODB and you will find what you need!

I tried to search but I couldn't find any good script...

Now I installed Access 2010, but the error persist

Access.au3 line 291

The requested action with this object has failed.:
$oADO.Execute ("CREATE TABLE " & $adTable & '(' & $F_Out & ')')
$oADO.Execute ("CREATE TABLE " & $adTable & '(' & $F_Out & ')')^ ERROR
Edited by FSoft

Share this post


Link to post
Share on other sites

If you work with objects you need a COM error handler to grab error information to help you debug your code.

Something like:

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

; Here goes your code 

; User's COM error function. Will be called if COM error occurs
Func _ErrFunc($oError)
; Do anything here.
ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _
"err.windescription:" & @TAB & $oError.windescription & @CRLF & _
"err.description is: " & @TAB & $oError.description & @CRLF & _
"err.source is: " & @TAB & $oError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
"err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
"err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
"err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
EndFunc ;==>_ErrFunc

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

It outputs this

err.number is: 0

err.windescription: 0

err.description is: 0

err.source is: 0

err.helpfile is: 0

err.helpcontext is: 0

err.lastdllerror is: 0

err.scriptline is: 0

err.retcode is: 0

Share this post


Link to post
Share on other sites

I figured out I have to put that code in AccessConstants.au3

It gives this:

err.description is: La query deve contenere almeno un campo di destinazione.

err.windescription: Errore non specificato.

err.number is: 80020009

err.lastdllerror is: 0

err.scriptline is: 67

err.source is: Microsoft JET Database Engine

err.helpfile is:

err.helpcontext is: 5003000

Share this post


Link to post
Share on other sites

It look like the SQL statement is wrong (if Google translated correctly from italian to german)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Ok, I figured out that error is because I didn't create any primary key.

Now I created one, but I'm getting another error when I try to add a record.

It says "Type Incompatibility".

It's strange because I set the fields of the database to "text" and my script write text strings (I also tried to put the strings in String())

How can I do now? :-(

Share this post


Link to post
Share on other sites

Anyone knows why it says "Type Incompatibility"?

Share this post


Link to post
Share on other sites
Why noone helps me with this "Type Incompatibility" error?

Share this post


Link to post
Share on other sites

You will have to post your code and give more details in order for someone to help you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0