Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 928
  • Last Modified:

Add/edit database records VB-access

How do you add and edit records in a database in access using VBS?
0
mattewjones
Asked:
mattewjones
  • 3
  • 3
  • 3
  • +1
1 Solution
 
Richie_SimonettiCommented:
did you mean VBScript or plain VB?
0
 
Richie_SimonettiCommented:
Related (VB, in vbscript is a little diferent)

http://www.vbcode.com/asp/showsn.asp?theID=250
0
 
Arthur_WoodCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
0
 
Arthur_WoodCommented:
where are you going to use this VBScript?  in what application?

AW
0
 
gajendraCommented:
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
 
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
0
 
Arthur_WoodCommented:
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
 
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
0
 
Richie_SimonettiCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now