Login | |
|
 |
RE: MS Access97 - 2/17/2006 11:10:22 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
The next thing I would question is the use of the ! accessor. I believe that is a VBA construct and not valid in VBS. As a matter of fact I think most of your code is VBA not VBScript. I would suggest searching this forum or the web for examples of using VBScript to manipulate an access db.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: MS Access97 - 2/18/2006 6:57:21 AM
|
|
 |
|
| |
mojeaux65
Posts: 7
Score: 0
Joined: 2/16/2006
Status: offline
|
Ok, made another pass at this... but I have several questions, if you don't mind.... I have added them where they apply in the script.. please see below. <html> <head> <SCRIPT language="VBScript"> Sub Add_newrec() 'In this sample vbscrption, no variables were declared... do I need to do that? If so, do I declare all of them? 'What are these(what do they do for the user)? Const adOpenStatic = 3 Const adLockOptimistic = 3 Const adUseClient = 3 Set objConnection = CreateObject("ADODB.Connection") Set objRecordset = CreateObject("ADODB.Recordset") 'Using this configuration, Do I include the path names to the database? and should I use the .mdb extension? objConnection.Open "DSN=\\dataserver name\TESTDB\Proj1;" 'What does cursorlocation do? Is it required in adding/updating records in the db? objRecordset.CursorLocation = adUseClient 'Do I have to run a query before adding a record? If I just want to add a record to table, 'can I just open the table? Do you have the syntax for this? objRecordset.Open "SELECT * FROM Hardware" , objConnection, adOpenStatic, adLockOptimistic Set colSoundCards = GetObject("winmgmts:").ExecQuery("Select * from Win32_SoundDevice") 'Do I have to declare the text box values or can I just point to the value in the form? objRecordset.AddNew objRecordset("Name") = myform.name.Value objRecordset("Email") = myform.Email.Value objRecordset("Phone") = myform.Phone.Value objRecordset("Status") = myform.Status.Value objRecordset("Date") = myform.Date.Value objRecordset("Note") = myform.Note.Value objRecordset.Update objRecordset.Close objConnection.Close End Sub </Script></head> <body> <body> <form name="myform"> Name: <input type="text" name="Name" size="50"><br> E-mail: <input type="text" name="Email" size="50"><br> Phone: <input type="text" name="Phone" size="50"><br> Status: <input type="text" name="Status" size="50"><br> Date: <input type="text" name="Date" size="50"><br> Note: <input type="text" name="Note" size="50"><br> <input type="submit" value="Submit" name="B1" onClick="Add_newrec()"> <input type="reset" value="Reset" name="B2"> </form> </body> </body> </html> Alot of questions, I know! I am truly a newbie at this. Your help is greatly appreciated.
|
|
| |
|
|
|
|
|