refresh on a form

G

Guest

hi to all.... I'm adding in a form some computer repair requests from a word
document. I have a button, that when I click on it, it grabs the info from
the word document and adds it into my database. the thing is that I have to
go out of the form and open it up again to see my new record.

I tried Me.requery
docmd.requery ("name of my form") but it's not working....
I'm not sure where I have to put it, so here is a little bit of my code and
if you can tell me exactly what to put and where, I would be very greatful.


Dim oDoc As Object 'Word.Document
Dim strEmployeeName As String
Dim strSiteName As String
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset


'Open the document in an instance of Word
Set oDoc = GetObject("C:\ComputerRepair3.doc")


'Get the contents of the formfields
strEmployeeName = oDoc.formfields("Text7").result
strSiteName = oDoc.formfields("Dropdown4").result

'Close the document without saving
oDoc.Close False

'appending the new record to the table
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\"Inventory.mdb;"
rst.Open "CRR Test", cnn, _
adOpenKeyset, adLockOptimistic

With rst
.AddNew
!employee = strEmployeeName
!site = strSiteName
.Update
.Close
End With
If blnQuitWord Then appWord.Quit
cnn.Close
MsgBox "CRR Imported!"

Cleanup:
Set rst = Nothing
Set cnn = Nothing
Set oDoc = Nothing
Exit Sub

End Sub

thank you very much for your answer in advance.
 
L

Larry Daugherty

You might try the Refresh Method:
me.refresh

just before you exit the event procedure.

HTH
 
G

Guest

hi larry.. thank you but it's still not working.... I still have to exit the
form and open it up again.. don't know what's going on. I've tried everything.

what else can I do????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top