Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003

    Unanswered: Open form for each instance in a query

    So I don't really understand ADO or recordsets, so that's no help. There are probably several ways to attack this:

    I want to query a scheduled events table for [alarmflag]=true and [nextalarmtime] <=now().
    Then I want to open a form frmscheduledactivities for each instance - probably as a popup, because I want to force the user to either deal with the alarm or "snooze/reschedule" the activity.

    This seems simple enough - in concept, but I can't seem to figure it out. . . by the way, each scheduled activity has [activityuid] as a unique record identifier.

    Any help would REALLY be appreciated.

    Thanks in advance.

  2. #2
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    You want multiple instances of the same form open? That will be hard to do without a recordset to keep track of the different records for each instance. Here's the basics:

    I would just have a continuous form with all the records displayed.

  3. #3
    Join Date
    Dec 2004
    Madison, WI
    It almost sounds like you want to cycle through the records and open the popup form in a dialog session (i.e. getting input on the popup form) before continueing again with the cycle through the records. If I'm reading you right, (not sure though - I could be off base), but the code would be like (in ADO):

    Function LoopThroughRecordset()
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    Dim strSQL As String
    strSQL = "Select * from MyTable"
    rs.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
    Do While Not rs.EOF
    DoCmd.OpenForm "MyPopUpForm", , , , , acDialog
    ' something else or get value from MyForm
    Set rs = Nothing
    MsgBox "Done"
    End Function

    What this will do is wait once MyForm is opened on you doing something before continuing on through the recordset.
    Last edited by pkstormy; 10-26-06 at 23:17.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts