[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

04/04/2007 at 03:08PM PDT, ID: 22493182
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.4

No Current record Error message on Multi-Select Listbox

Asked by kfschaefer1 in Access Coding/Macros, Microsoft Development, Microsoft Access Database

Tags: current, record

the current code works find on a single selection in the listbox, but I get an error"No Current Record" with a multi-selection.  

Private Sub cmdDeleteSelect_Click()
    Dim db As DAO.Database
    Dim rs, rs1, rs2 As DAO.Recordset
    Dim strSQL, strSQL_1, strSQL2, strSQL3, nJG As String
    Dim lngCount, lngLoop, lngLoop1, lngID, lngID2, nSRCtr As Long
    Dim fld As DAO.Field
    Dim varNumber As Variant

On Error GoTo Err_cmdDeleteSelect_Click

Select Case MsgBox("ARE YOU SURE YOU WANT TO DELETE THE SELECTED RECORDS?", _
    vbYesNoCancel Or vbExclamation Or vbDefaultButton1, _
    "Deleting the Selected Records")

    Case vbYes
        If lstSRTemp.ItemsSelected.Count = 0 Then
            MsgBox "You must select at least one SR item to be Deleted."
                Exit Sub
        Else:
            varNumber = lstSRTemp.ItemsSelected.Count
            nSRCtr = 0
            Set db = CurrentDb
            Set rs = db.OpenRecordset("TA_SRArchiveData", dbOpenDynaset)
               For varNumber = IIf(Me.lstSRTemp.ColumnHeads, 1, 0) To Me.lstSRTemp.ListCount - 1
                    If nSRCtr = lstSRTemp.Column(0) Then
                        GoTo cont2:
                    Else
                        nSRCtr = lstSRTemp.Column(0)
                        nJG = lstSRTemp.Column(1)
                           strSQL = "SELECT top 1 * FROM TA_SR where Job_Group =" & Chr(34) & nJG & Chr(34) & ""
                           strSQL_1 = "SELECT Max(Job_Group) AS MaxOfJob_Group" & _
                                " FROM TA_SRArchiveData " & _
                                " ORDER BY Max(Job_Group) DESC"
                            Set rs1 = CurrentDb.OpenRecordset(strSQL_1)
                            Set rs2 = CurrentDb.OpenRecordset(strSQL)
                            lngID2 = rs1.Fields("MaxOfJob_Group").Value
                            With rs2
                                If rs2.Fields("SubmittedSR").Value = True Then
                                    Select Case _
                                        MsgBox("You CANNOT delete this record, due to being previously submitted.  Do you wish to create a copy of this record for a new SR?", _
                                        vbYesNo Or vbExclamation Or _
                                        vbDefaultButton1, _
                                        "Deleting Previously Submitted")
                                   
                                        Case vbYes
                                            cmdCopyNewRec_Click
                                        Case vbNo
                                            GoTo Exit_cmdDeleteSelect_Click:
                                    End Select
                                End If
                                If rs2.Fields("Job_Group").Value = lngID2 Then
                                    lngID = 0
                                End If
                                    lngCount = .RecordCount
                                    If lngCount > 0 Then
                                    While .EOF = False
                                        For lngLoop = 1 To lngCount
                                            With rs
                                                .AddNew
                                                   If lngID = 0 Then
                                                       lngID = rs2.Fields("SRctr").Value
                                                   End If
                                                    For Each fld In rs.Fields
                                                        With fld
                                                            If .Attributes And dbAutoIncrField Then
                                                                GoTo NextCont:
                                                            End If
                                                                rs.Fields(.Name).Value = rs2.Fields(.Name).Value
                                                        End With
NextCont:                                            Next
                                                .Update
                                                End With
                                         If lngLoop = lngCount Then
                                                'GoTo cont1:
                                            End If
                                        Next
                                        .MoveNext
                                    Wend
                                    End If
                            End With
                        strSQL2 = "SELECT * FROM tblEquipListingPerJobGroup where Job_Group =" & Chr(34) & nJG & Chr(34) & ""
                        strSQL3 = "SELECT * FROM TBL_EquipList_ARCHIVE"
                        Set rs1 = CurrentDb.OpenRecordset(strSQL2)
                        Set rs2 = CurrentDb.OpenRecordset(strSQL3)
                        rs1.MoveLast
                           lngCount = rs1.RecordCount
                        rs1.MoveFirst
                           With rs1
                                If rs1.Fields("Job_Group").Value = lngID2 Then
                                    lngID = 0
                                End If
                                    If lngCount > 0 Then
                                        Do Until rs1.EOF
                                            With rs2
                                                .AddNew
                                                    For Each fld In rs1.Fields
                                                        With fld
                                                            If .Attributes And dbAutoIncrField Then
                                                                GoTo NextCont1:
                                                            End If
                                                                rs2.Fields(.Name).Value = rs1.Fields(.Name).Value
                                                        End With
NextCont1:                                           Next
                                                .Update
                                                End With
                                               lngLoop1 = lngLoop1 + 1
                                            If lngLoop1 = lngCount Then
                                                GoTo cont1:
                                            End If
                                         rs1.MoveNext
                                        Loop
cont1:                              End If
                            End With
                            strSQL = "Select * from TA_SR WHERE Job_Group = " & Chr(34) & nJG & Chr(34) & ""
                                Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
                                   If Not rs.NoMatch Then
                                      rs.Delete
                                   End If
                            strSQL = "Select * from tblEquipListingPerJobGroup WHERE Job_Group = " & Chr(34) & nJG & Chr(34) & ""
                                Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
                                   If Not rs.NoMatch Then
                                    rs.MoveLast
                                        lngCount = rs.RecordCount
                                    rs.MoveFirst
                                    With rs
                                        If rs.Fields("Job_Group").Value = lngID2 Then
                                           lngID = 0
                                        End If
                                        If lngCount > 0 Then
                                            Do Until rs.EOF
                                                rs.Delete
                                                lngLoop1 = lngLoop1 + 1
                                                If lngLoop1 = lngCount Then
                                                    GoTo cont2:
                                                End If
                                            rs.MoveNext
                                            Loop
                                        End If
cont2:                                End With
                                    End If
                            strSQL = "Select * from tblSRListTemp WHERE Job_Group = " & Chr(34) & nJG & Chr(34) & ""
                                Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
                                   If Not rs.NoMatch Then
                                    rs.MoveLast
                                        lngCount = rs.RecordCount
                                    rs.MoveFirst
                                    With rs
                                        If rs.Fields("Job_Group").Value = lngID2 Then
                                           lngID = 0
                                        End If
                                        If lngCount > 0 Then
                                            Do Until rs.EOF
                                                rs.Delete
                                                lngLoop1 = lngLoop1 + 1
                                                If lngLoop1 = lngCount Then
                                                    GoTo cont2:
                                                End If
                                            rs.MoveNext
                                            Loop
                                        End If
                                    End With
                                    End If
                            rs.Close
                            db.Close
                    End If
                Next varNumber
Set db = Nothing
Set rs = Nothing
Set rs1 = Nothing
Set rs2 = Nothing
           Me.lstSRTemp.Requery
           Me.FilterSub.Requery
        End If
    Case vbNo
        GoTo Exit_cmdDeleteSelect_Click:

    Case vbCancel
        GoTo Exit_cmdDeleteSelect_Click:

End Select

Exit_cmdDeleteSelect_Click:
    Exit Sub

Err_cmdDeleteSelect_Click:
    MsgBox Err.Description
    Resume Exit_cmdDeleteSelect_Click
   
End Sub
[+][-]04/04/07 03:11 PM, ID: 18854259

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/04/07 03:15 PM, ID: 18854283

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/04/07 03:17 PM, ID: 18854291

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/04/07 03:20 PM, ID: 18854306

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/04/07 03:22 PM, ID: 18854316

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/04/07 03:25 PM, ID: 18854334

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/04/07 03:49 PM, ID: 18854421

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/04/07 04:14 PM, ID: 18854517

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/04/07 04:16 PM, ID: 18854522

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/04/07 04:39 PM, ID: 18854623

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Microsoft Development, Microsoft Access Database
Tags: current, record
Sign Up Now!
Solution Provided By: jefftwilley
Participating Experts: 4
Solution Grade: A
 
 
[+][-]04/04/07 04:42 PM, ID: 18854633

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/04/07 04:44 PM, ID: 18854640

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 06:51 AM, ID: 18857705

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 06:55 AM, ID: 18857733

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 08:26 AM, ID: 18858507

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 08:32 AM, ID: 18858559

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 08:34 AM, ID: 18858581

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 08:42 AM, ID: 18858659

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 08:47 AM, ID: 18858704

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 08:48 AM, ID: 18858707

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 08:49 AM, ID: 18858723

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 08:52 AM, ID: 18858747

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 08:53 AM, ID: 18858763

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 08:53 AM, ID: 18858764

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 08:54 AM, ID: 18858779

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 08:56 AM, ID: 18858790

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 08:57 AM, ID: 18858806

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 09:00 AM, ID: 18858831

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 09:04 AM, ID: 18858862

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 09:23 AM, ID: 18859033

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 09:34 AM, ID: 18859125

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 09:40 AM, ID: 18859171

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 09:42 AM, ID: 18859181

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 09:43 AM, ID: 18859192

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/07 10:22 AM, ID: 18859487

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/05/07 10:23 AM, ID: 18859496

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74