From: torka on

Hi All,

I've tried to insert some string to my access database using vbscript
through SecureCRT. This is my current code:
>
> # $language = "VBScript"
> # $interface = "1.0"
> dim qstr
> ' Create new instance of Microsoft Access.
> Set objAccess = CreateObject("Access.Application")
>
> ' Open database in Microsoft Access window.
> objAccess.OpenCurrentDatabase("E:\Rama_kerjaan\VBScrippt-Access\Code\coba.mdb")
>
> ' insert the data
> qstr = "INSERT INTO gateway (Sortir) values('12')"
> objAccess.DoCmd.RunSQL qstr
> But the error came at:
objAccess.DoCmd.RunSQL qstr
The error message is "The RunSQL action was canceled"
Does anyone knows my problem here? It would be very helpful.

Thanks....


--
torka
From: torka on

I have resolved this problem by using Execute command.
>
> # $language = "VBScript"
> # $interface = "1.0"
> dim qstr
> ' Create new instance of Microsoft Access.
> Set objAccess = CreateObject("Access.Application")
>
> ' Open database in Microsoft Access window.
> objAccess.OpenCurrentDatabase("E:\Rama_kerjaan\VBScrippt-Access\Code\coba.mdb")
>
> ' insert the data
> qstr = "(INSERT INTO gateway (Sortir) VALUES ('15'))"
> objAccess.CurrentDb.Execute qstr
>
> objAccess.CurrentDb.close
> objAccess.quit
>


--
torka