Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2011

    a "workflow" form and table, issue with openrecordset

    This is my first post .. so please be gentle.. I have a fairly simply "workflow" type of form .. basically to ask the user a question, and based on the answer, it would display the next assigned record or "step" .. answers could be yes / no / ok / or mult choice .. i had copied most of the code from a previous co-workers db, which worked fine .. it was built in access 2000, now i'm using 2003, there was a a few things i had to change .. anyway, no matter which option i choose (yes/no/etc), it gives error 3021, no current record, and stops at the .MoveFirst line .. here is the code, wasn't sure how much to include, so this is all:

    Option Compare Database
    Const HandleErrors As Boolean = True

    Private Sub Close_Click()
    On Error GoTo Err_Close_Click


    Exit Sub

    MsgBox Err.Description
    Resume Exit_Close_Click

    End Sub

    Private Sub Form_Load()
    NextStep 1

    End Sub

    Private Sub No_Click()
    NextStep CInt(NoStep)

    End Sub

    Private Sub Ok_Click()
    NextStep CInt(OkStep)

    End Sub

    Private Sub Response_Values_AfterUpdate()

    If Left(Me.[Response Values], 1) = "1" Then
    NextStep CInt(Response1Step)
    ElseIf Left(Me.[Response Values], 1) = "2" Then
    NextStep CInt(Response2Step)
    ElseIf Left(Me.[Response Values], 1) = "3" Then
    NextStep CInt(Response3Step)
    ElseIf Left(Me.[Response Values], 1) = "4" Then
    NextStep CInt(Response4Step)
    End If

    End Sub

    Private Sub Start_over_Click()
    NextStep 1

    End Sub

    Private Sub Yes_Click()
    NextStep CInt(YesStep)

    End Sub

    Sub NextStep(NewStep As Integer)
    [Current Step].SetFocus
    Dim rsCouncilWorkflow As Object
    Set rsCouncilWorkflow = CurrentDb.OpenRecordset("SELECT * FROM [Council Workflow] WHERE [Current Step] = " & NewStep & ";")
    [Current Step] = rsCouncilWorkflow![Current Step]
    [Question] = rsCouncilWorkflow![Question]
    [Yes].Visible = False
    [No].Visible = False
    [Ok].Visible = False
    [Response Values].Visible = False

    YesStep = Null
    NoStep = Null
    OkStep = Null
    Response1Step = Null
    Response2Step = Null
    Response3Step = Null
    Response4Step = Null

    If IsNull(rsCouncilWorkflow![Yes]) = False Then [Yes].Visible = True: YesStep = rsCouncilWorkflow![Yes]
    If IsNull(rsCouncilWorkflow![No]) = False Then [No].Visible = True: NoStep = rsCouncilWorkflow![No]
    If IsNull(rsCouncilWorkflow![Ok]) = False Then [Ok].Visible = True: OkStep = rsCouncilWorkflow![Ok]
    If IsNull(rsCouncilWorkflow![Response Values]) = False Then
    [Response Values].Visible = True
    [Response Values].RowSource = rsCouncilWorkflow![Response Values]
    Response1Step = rsCouncilWorkflow![Response 1]
    Response2Step = rsCouncilWorkflow![Response 2]
    Response3Step = rsCouncilWorkflow![Response 3]
    Response4Step = rsCouncilWorkflow![Response 4]
    End If


    End Sub

    **added info .. the first couple rows of the table to help make sense .. in the attachment
    Attached Thumbnails Attached Thumbnails untitled.bmp  
    Last edited by snoodledorf; 12-13-12 at 00:28. Reason: additional info at the bottom

  2. #2
    Join Date
    Oct 2011
    got it figured out, missing controls on the form, embarassing

Tags for this Thread

Posting Permissions

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