Hello Maarkr.
> I have twenty forms that need to open and close in order
> (increment by 1) using an On_Click event. I added a table named
[quoted text clipped - 12 lines]
> DoCmd.Open Form "get the formname from tableofforms.column(1) where
> intformnbr = tableofforms.column(0) aaaaarrrrggggg!"
You could simply get the name of the form with a DLookup:
DLookup("FormName", "TableOfForms", "FormNo=" & intFormNbr)
And of course, you could use a recordset instead:
Dim strSQL as String, strNextForm as String
strSQL = "Select FormName From TableOfForms Order By FormNo"
With CurrentDb.OpenRecordset(strSQL, dbOpenFormwardOnly)
.FindFirst BuildCriteria("FormName", dbText, Me.Name)
If Not .NoMatch Then
.MoveNext
if Not .EOF Then strNextForm = !FormName
End If
.Close
End With
If strNextForm <> vbNullString Then DoCmd.OpenForm strNextForm

Signature
Regards,
Wolfgang
Maarkr - 30 Oct 2007 19:36 GMT
The old "double DLookup" trick. new it wasn't too hard...thanks
> Hello Maarkr.
>
[quoted text clipped - 31 lines]
> End With
> If strNextForm <> vbNullString Then DoCmd.OpenForm strNextForm