Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help getting lastrecord into form from a different table.

Status
Not open for further replies.

InfoNow

IS-IT--Management
Apr 20, 2001
106
US
My primary form, frmDOCUMENTS(tblDOCUMENTS) have a subform called frmREVISIONS(tblREVISIONS). They are linked using DocNum. For each DocNum, there can be many revisions(RevNum). What I would like to have on my primary form is an unbound box displaying the latest revision number for the linked DocNumber. For example, DocNum 100 have 20 revisions. The unbound box should display 20. Not sure if this clear for you gurus to help me out.

Thanks,
 
I do something very similar using a recordset. It might not be the most effecient way to handle this but I know it works.
Code:
 strsql = strsql + "SELECT...
    Set QueryDefinitionTemp = dbs.CreateQueryDef("", strsql)
    qdfTemp.ReturnsRecords = True
    Set Recordset = qdfTemp.OpenRecordset(dbOpenDynaset, dbSeeChanges)
Recordset.MoveLast  
DocNum = Recordset.Fields("DocumentNumber")
Recordset.Close
Set Recordset = Nothing
I hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top