Add/edit database records VB-access

How do you add and edit records in a database in access using VBS?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richie_SimonettiIT OperationsCommented:
did you mean VBScript or plain VB?
Richie_SimonettiIT OperationsCommented:
Related (VB, in vbscript is a little diferent)
is this for use in an ASP Page?

dim objConn
dim strSQL
dim rs

set objConn = Server.CreateObject("ADODB.Connection")
set rs = Server.GetObject("ADODB.Recordset")
objConn.ConnectionString = <connection string to your database>

strSQL = "Select * from YourTable where 1=0"

  rs.Fields("Column1") = Value1

OR, to edit a record:

strSQL = "Select * from YourTable where Field = " & SelectedValue


rs.Fields("Field2") = NewValue

is that what you mean?


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

mattewjonesAuthor Commented:
I just want the code for my question vbs - visual basics script so i want the script the code if u like u know wot i mean
where are you going to use this VBScript?  in what application?

You could try the data control and the dbgrid combination for the simplest option.

Alternately, you could let the Wizards design your first data entry program and evaluate the same thereafter.

mattewjonesAuthor Commented:
RE: where are you going to use this VBScript?  in what application?

Arnt I asking the question? All i wanted was the code now go away be4 i bring out my AK
knowing where you are using the VBScript makes a difference.  But if it is so hush hush, and you are goingto take thaat attitude,then good luck getting help from any one here.

I am just trying to get some clarification, so that the answer will be appropraite to the circumstances.

mattewjonesAuthor Commented:
no i didnt ask that wot do u mean....?
VB im using VB so obtusily i will be entering VBS

Jus go home
Richie_SimonettiIT OperationsCommented:
I don't understand that attitude, what's the problem that Experts ask for more details?, do you want to find an accurate solution or not?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.