"Eric Schittlipz" <er**@schittlipz.com> wrote in message news:<co**********@hercules.btinternet.com>...
"Pete" <so**********@netzero.net> wrote in message
news:8f**************************@posting.google.c om... Yes it would be a network backend .mdb database. That's exactly the
syntax I'm looking for but I need to embed this in a simple .html file
with a textbox and button so that users can insert the record to the
mdb via the vbscript. Would you happen to have the syntax to activate
this from a web page? Any method will do (vbscript asp ...) Thanks
If you need only a single textbox, to get data from the user, then using a
stand-alone vb-script would be the simplest (without using a web page) but
using a web-page would give you more control and if you used something like
asp, then no-one could see/amend the script. However, there are two
hurdles: Firstly, you need to have a machine running IIS, and you should try
to publish an initial test page first. Once you have that working you can
create the script to add the record, but you need to let us know something
about the table structure for the record to be added. For example, database
has a single table tblContacts with two fields, ConID is an autonumber field
which serves as the primary key and ConName is the contact's name which is
input by the user. With that sort of info, someone could write the script.
You could try a simple html application. You would probably want to
add some more robust data validation. It doesn't require a server.
Only IE 5 and above and vbScript.
http://msdn.microsoft.com/workshop/a...taoverview.asp
The example below is very basic but should give you an idea of what it
does.
<html>
<head>
<title>
Data Add Form
</title>
<script language="vbscript">
sub cmdAdd_onClick
dim dbEng
dim wrksp
dim db
if VerifyData()=true then
set dbEng = createobject("dao.dbengine.36")
dbEng.systemdb = "pathtoworkgroupfile"
dbEng.defaultuser = "username"
dbEng.defaultpassword = "password"
set wrksp = dbEng.workspaces(0)
set db = wrksp.opendatabase("PathToDataBase",false,false)
db.execute "INSERT INTO tblData(DataField) " _
& "VALUES('" & txtData.value & "');",128
msgbox "Data Added"
txtData.value = ""
db.close
set db = nothing
wrksp.close
set wrksp = nothing
set dbEng = nothing
else
msgbox "Hey enter Data"
txtData.value=""
end if
end sub
function VerifyData()
if len(trim(txtData.value))=7 then
if isnumeric(txtData.value) then
VerifyData=true
else
VerifyData=false
end if
else
VerifyData=false
end if
end function
</script>
</head>
<body>
<fieldset>
<legend>Enter data to add</legend>
<center>
<input type="text" size="7" maxlength="7" name="txtData"></br>
</p>
<input type="button" name="cmdAdd" value="Add">
</center>
</fieldset>
</br>
</body>
</html>