Ref a form outside access

  • Thread starter Thread starter Nick_the_tent
  • Start date Start date
N

Nick_the_tent

Hi
I can requery a form within access like this:

Dim con As Form
Set con = Form_frm_contactnotes_subform
con.Requery

works fine, but am trying to do the same from a word application, i.e. after
the user has saved a revised document is automatically updated in a
'history' subform.


With Dialogs(wdDialogFileSaveAs)
If .Show = -1 Then
Dim f_name As String
f_name = ActiveDocument.FullName
Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim con As Form
Dim strid As String
strtid = ActiveDocument.Variables("vquoteid").Value
Set db = DAO.OpenDatabase("C:\OrderDatabase.mdb")
Set rec = db.OpenRecordset("tbl_Contactnotes")
With rec
..AddNew
!quoteID = ActiveDocument.Variables("vquoteid").Value
!ContactnoteDate = Now()
!ContactNoteCreator = CurrentUser()
!ContactnoteNote = "revised document"
!ContactlinkedDoc = "click here to open the document #" & f_name & "#"
..Update
End With
xxxxxxxxxxxxxxxxxxxxx
this bits not working
Set con = db(Form!frm_contactnotes_subform)
con.Requery
xxxxxxxxxxxxxxxxxxxx
Else
End If
End With

any help would be appreciated

TIA

Nick
 
The forms collection is within the application object and
not a part of DAO. You could try something along the lines of

Dim acApp As Access.Application

Set acApp = GetObject("C:\OrderDatabase.mdb")
acApp.Forms("frm_contractnotes_subForm").Requery

or if it is an embedded subform
acApp.Forms(parentFormName).Controls(subFormControlName).Form.Requery

Hope This Helps
Gerald Stanley MCSD
 
Back
Top