doh, i'm an idiot, had repiled once already but didn't notice you said it was an access database....
ok, there's two different ways you can do this. one is to use ASP and/or vbscript, which I have no clue how you would program... but if it's any help, here is code I used for something similar to this through a VB6 app
after you include the DAO Object Library in your project through the references window, you bind your controls to fields in the database, then I used this code:
'Dim variables to hold the db and recordset.
Dim mdbCurrent As Database
Dim mrstCurrent As Recordset
Private Sub Form_Load()
* 'Set variables, load the current record, and we're not in edit mode.
* Set mdbCurrent = OpenDatabase(App.Path & "\Paymast.mdb")
* Set mrstCurrent = mdbCurrent.OpenRecordset("tblEmployees")
* Call LoadCurrentRecord
* Call SetEditState(False)
End Sub
Private Sub LoadCurrentRecord()
* 'Clear text boxes.
* txtEmployeeID.Text = mrstCurrent![fldEmployeeID]
* txtLastName.Text = mrstCurrent![fldLastName]
* txtFirstName.Text = mrstCurrent![fldFirstName]
* txtStreet.Text = mrstCurrent![fldStreet]
* txtCity.Text = mrstCurrent![fldCity]
* txtState.Text = mrstCurrent![fldState]
* txtZipCode.Text = mrstCurrent![fldZipCode]
* txtHourlyWage.Text = mrstCurrent![fldHourlyWage]
* txtTaxRate.Text = mrstCurrent![fldTaxRate]
End Sub
Private Sub SaveCurrentRecord()
* 'Write the text boxes back to the db.
* mrstCurrent![fldEmployeeID] = txtEmployeeID.Text
* mrstCurrent![fldLastName] = txtLastName.Text
* mrstCurrent![fldFirstName] = txtFirstName.Text
* mrstCurrent![fldStreet] = txtStreet.Text
* mrstCurrent![fldCity] = txtCity.Text
* mrstCurrent![fldState] = txtState.Text
* mrstCurrent![fldZipCode] = txtZipCode.Text
* mrstCurrent![fldHourlyWage] = txtHourlyWage.Text
* mrstCurrent![fldTaxRate] = txtTaxRate.Text
* mrstCurrent.Update
End Sub
Private Sub mnuEditAdd_Click()
* 'Move to the last record, add a new one, clear the boxes, and yes, we are editing.
* mrstCurrent.MoveLast
* mrstCurrent.AddNew
* Call ClearCurrentRecord
* Call SetEditState(True)
End Sub
Private Sub mnuEditCancel_Click()
* 'Ok, I changed my mind, now I don't want to update a record. *Load the current
* 'record and set the edit state to false.
* mrstCurrent.CancelUpdate
* Call LoadCurrentRecord
* Call SetEditState(False)
End Sub
Private Sub mnuEditDelete_Click()
* 'Delete the current record, go to the last one, load it, and set the edit state to false.
* mrstCurrent.Delete
* mrstCurrent.MoveLast
* Call LoadCurrentRecord
* Call SetEditState(False)
End Sub
Private Sub mnuEditEdit_Click()
* 'Now we want to edit a record, set the state to true, and edit away.
* Call SetEditState(True)
* mrstCurrent.Edit
End Sub
Private Sub mnuEditUpdate_Click()
* 'If none of the text boxes are blank, save the record and set the state to false,
* 'else cancel the update, load the current record, set the state to false,
* 'and tell the user to fill everything in.
* If txtEmployeeID.Text = "" Or txtLastName.Text = "" Or txtFirstName.Text = "" _
* Or txtStreet.Text = "" Or txtCity.Text = "" Or txtState.Text = "" _
* Or txtZipCode.Text = "" Or txtHourlyWage.Text = "" Or txtTaxRate.Text = "" Then
* * * MsgBox "Please fill out all of the fields."
* * * mrstCurrent.CancelUpdate
* * * Call LoadCurrentRecord
* * * Call SetEditState(False)
* * * Exit Sub
* End If
* Call SaveCurrentRecord
* Call SetEditState(False)
End Sub
Private Sub mnuFileExit_Click()
* 'I don't want to run anymore.
* Unload Me
End Sub
Private Sub mnuViewFirst_Click()
* 'Move to and load the first record.
* mrstCurrent.MoveFirst
* Call LoadCurrentRecord
End Sub
Private Sub mnuViewLast_Click()
* 'Move to and load the last record.
* mrstCurrent.MoveLast
* Call LoadCurrentRecord
End Sub
Private Sub mnuViewNext_Click()
* 'Move to and load the next record, unless we're at the end already.
* mrstCurrent.MoveNext
* If mrstCurrent.EOF Then
* * * mrstCurrent.MoveLast
* End If
* Call LoadCurrentRecord
End Sub
Private Sub mnuViewPrevious_Click()
* 'Move to and load the previous record, unless we're at the beginning.
* mrstCurrent.MovePrevious
* If mrstCurrent.BOF Then
* * * mrstCurrent.MoveFirst
* End If
* Call LoadCurrentRecord
End Sub
Private Sub SetEditState(pblnEditing As Boolean)
* If pblnEditing Then
* * * 'Unlock all the text boxes, and enable / disable menu items.
* * * txtEmployeeID.Locked = False
* * * txtLastName.Locked = False
* * * txtFirstName.Locked = False
* * * txtHourlyWage.Locked = False
* * * txtStreet.Locked = False
* * * txtCity.Locked = False
* * * txtState.Locked = False
* * * txtZipCode.Locked = False
* * * txtTaxRate.Locked = False
* * * mnuEditEdit.Enabled = False
* * * mnuEditUpdate.Enabled = True
* * * mnuEditCancel.Enabled = True
* * * mnuEditDelete.Enabled = False
* * * mnuEditAdd.Enabled = False
* * * mnuView.Enabled = False
* Else
* * * 'Lock all the text boxes, and enable / disable menu items.
* * * txtEmployeeID.Locked = True
* * * txtLastName.Locked = True
* * * txtFirstName.Locked = True
* * * txtHourlyWage.Locked = True
* * * txtStreet.Locked = True
* * * txtCity.Locked = True
* * * txtState.Locked = True
* * * txtZipCode.Locked = True
* * * txtTaxRate.Locked = True
* * * mnuEditEdit.Enabled = True
* * * mnuEditUpdate.Enabled = False
* * * mnuEditCancel.Enabled = False
* * * mnuEditDelete.Enabled = True
* * * mnuEditAdd.Enabled = True
* * * mnuView.Enabled = True
* End If
End Sub
Private Sub ClearCurrentRecord()
* 'Get rid of the text in the text boxes.
* txtEmployeeID.Text = ""
* txtLastName.Text = ""
* txtFirstName.Text = ""
* txtStreet.Text = ""
* txtCity.Text = ""
* txtState.Text = ""
* txtZipCode.Text = ""
* txtHourlyWage.Text = ""
* txtTaxRate.Text = ""
End Sub
The second way, and probably the easier way, is to use Access's built in data access pages. From what I can remember from my class, here is what you need to do.
1. Open your database up in Access.
2. Click pages on the objects window.
3. Choose either create data access page in design view, or create data access page using wizard.
4. Design your page similar to how you would design a form or switchboard in Access.
After you're done designing the page and save it, it will save an html file. You can publish this on the web, but, here's where you run into a problem.
You have to specify a connection string to your database, which if you're using it on a network, the easiest way is to use a UNC path, IE, \\server\share\mydb.mdb
But, if you use an absolute path, IE, c:\databases\mydb.mdb, then the database has to stay in that place, else when you open the data access page, it won't be able to find and connect to your database. You can edit the source of the page to get around that though. If you search for this line in the html source:
Data Source=D:\Adam\School\CIS 160\Cases 2\Delivery_SAT.mdb
and edit the path there, it will find it again. I think this is only going to be useful though for a local webserver / intranet, unless you can manage to get it to connect to a remote server somehow someway, ftp maybe? I've never tested it that way.
I've attached a pic of what a very basic data access page will look like once you've walked through the wizard... good luck, if you need help with it let me know and I'll look through my textbook if I don't know it off the top of my head, just finished a course last semester over Access
