Update table on the form

G

GGill

On my access form i will select record and then click button submit. It will
open asp page. So my selected record will populate to asp page and i clisk
finish, it will send data to client. When i did click on finish it will open
next page with text saying they received data and assigned a new number. What
i need to do is update that assigned new number to access table.
Here is my code in access db;

Private Sub cmdRun_Click()
Dim mdoc As Object
Dim strNewNumber As String
Dim strSQL As String
Dim rst As ADODB.Recordset
Dim cn As Connection
Dim loopCnt As Integer

Set rst = New ADODB.Recordset
Set obj = Nothing
Set obj = New InternetExplorer

rst.Open "select * from tblEmployee", CurrentProject.Connection,
adOpenKeyset, adLockOptimistic

obj.Navigate2 "C:\Dev\Submit.asp", False
logLoaded = False

obj.Visible = True

Do Until logLoaded
DoEvents
Loop

Set mdoc = obj.Document

logLoaded = False

obj.Visible = True

Do Until logLoaded
DoEvents
Loop

Set mdoc = obj.Document

strNumber = mdoc.all("NewNumber")

strSQL = "UPDATE tblEmployee SET tblEmployee.txtNumber ='" & strNumber &
" ' " _
& "WHERE (((tblEmployee.ID)=Forms!frmProvider!intID));"

Set cn = CurrentProject.Connection
cn.Execute strSQL
cn.Close
Set cn = Nothing
Set cn = Nothing
rst.Close
Set rst = Nothing
Set mdoc = Nothing

End Sub
====================

Please let me know what i need to do to make this work.

Thank you.
 
Top