I have a database that consists of a master form with subforms, that works as intended, along with using a macro to navigate to the last record. I then have a button on that master form which closes it and opens another form which consists of four tables. Each table is a lookup for the master form but that is irrelevant. What I need this second form to open each table at the last record I’m certain that I had it working at some stage but I had a major database failure and lost several days work, including the working code. (That’ll teach me not to keep my backups up to the minute when making code changes).
In my testing over the last couple of hours I have gotten the following macros working…sort of.
Sub oLast Dim oForm As Object, oSubFsize As Object, oSubFsize1 As Object Dim oSubFFV As Object, oSubFFV1 As Object Dim oSubCol As Object, oSubCol1 As Object oForm = ThisComponent.DrawPage.Forms.getByIndex(0) 'main form oForm.Last() oSubFsize = oForm.GetByName("SizeForm") 'subform1 oSubFsize1=oSubFsize.GetByName("frm_SIZE") oSubFsize1.FetchSize = 5000 oSubFsize1.moveToInsertRow() oSubFsize1.Last() oSubFFV = oForm.GetByName("frmFV") 'subform2 oSubFFV1=oSubFFV.GetByName("frm_FACE_VALUE") oSubFFV1.FetchSize = 5000 oSubFFV1.moveToInsertRow() oSubFFV1.Last() oSubCol = oForm.GetByName("ColourFrm") 'subform3 oSubCol1=oSubCol.GetByName("frmColour") oSubCol1.FetchSize = 5000 oSubCol1.moveToInsertRow() oSubCol1.Last()
If I step through the macro each form goes to last record as intended. if, however, I let the macro run , only the first form (Which contains the three other subforms) ends at the last record, all others return to the first.