Solved

Add/edit database records VB-access

Posted on 2003-11-26
10
911 Views
Last Modified: 2010-05-01
How do you add and edit records in a database in access using VBS?
0
Comment
Question by:mattewjones
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9824780
did you mean VBScript or plain VB?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9824797
Related (VB, in vbscript is a little diferent)

http://www.vbcode.com/asp/showsn.asp?theID=250
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 50 total points
ID: 9824811
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>
objConn.Open

strSQL = "Select * from YourTable where 1=0"
rs.OPenRecordset(strSQL)

rs.AddNew
  rs.Fields("Column1") = Value1
rs.Update

OR, to edit a record:

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

rs.OpenRecordset(strSQL)

rs.Fields("Field2") = NewValue
rs.Update


is that what you mean?

AW

0
 

Author Comment

by:mattewjones
ID: 9826391
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
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9827079
where are you going to use this VBScript?  in what application?

AW
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:gajendra
ID: 9831614
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.

Gajendra
0
 

Author Comment

by:mattewjones
ID: 9846360
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
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9852042
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.

AW
0
 

Author Comment

by:mattewjones
ID: 9882262
no i didnt ask that wot do u mean....?
VB im using VB so obtusily i will be entering VBS

Jus go home
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9882351
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?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now