code converting from VBA[access] to vb.net

gouthamsworld

Member
Joined
Oct 22, 2007
Messages
7
Programming Experience
1-3
hi all
i am a fresh graduate very poor in coding stuff..

i need to convert the following code in VBA to vb.net

can anybody plz plz plz send me the code in vb.net

VB.NET:
Sub assess()

Dim db As Database
Dim healthTbl As Recordset
Dim assessmentTbl As Recordset
Dim prepMckinseyTbl As Recordset
Dim prepCSITbl As Recordset
Dim prepStltSmtTbl As Recordset



'***********************************
Set db = CurrentDb()
Set assessmentTbl = db.OpenRecordset("APM_Assessment", dbOpenDynaset)
Set healthTbl = db.OpenRecordset("AppID", dbOpenDynaset)

Set prepMckinseyTbl = db.OpenRecordset("Prep_Mckinsey", dbOpenDynaset)
Set prepCSITbl = db.OpenRecordset("Prep_CSI", dbOpenDynaset)
Set prepStltSmtTbl = db.OpenRecordset("Prep_STLT_SMT", dbOpenDynaset)
Set prepEMSTbl = db.OpenRecordset("Prep_EMS", dbOpenDynaset)

'-----------------------
' Start to loop through all records

If healthTbl.EOF = True Then Exit Sub
If Not healthTbl.EOF Then healthTbl.MoveFirst ' healthTbl.MoveFirst
If Not assessmentTbl.EOF Then assessmentTbl.MoveFirst ' assessmentTbl.MoveFirst

Do While Not healthTbl.EOF ' Keep on looping until we go beyond the last record
    If assessmentTbl.EOF = True Then
        assessmentTbl.AddNew
    Else
        assessmentTbl.Edit
    End If
        
    assessmentTbl!AppID = healthTbl!AppID
    
'''' FIND STLT

 
    prepCSITbl.FindFirst ("AppID = " & healthTbl!AppID)
    If Not prepCSITbl.NoMatch Then
        prepStltSmtTbl.FindFirst ("SMT = '" & prepCSITbl!SMTLname & "'")
        If Not prepStltSmtTbl.NoMatch Then
            assessmentTbl!stlt = prepStltSmtTbl!stlt
        Else
            assessmentTbl!Debug = "NO MAPPING OF STLT"
        End If
    Else
        assessmentTbl!Debug = "NO SMT FOUND IN MAPPING"
    End If
    

    
''''BusinessAlignment ---
    prepMckinseyTbl.MoveFirst
    prepMckinseyTbl.FindFirst ("AppID = " & assessmentTbl!AppID)
    If prepMckinseyTbl.NoMatch Then
         assessmentTbl!BusinessAlignment = ""
    Else
        assessmentTbl!CurrentCompetitiveState = prepMckinseyTbl!CurrentCompetitiveState
        assessmentTbl!GoalCompetitiveState = prepMckinseyTbl!GoalCompetitiveState
        Select Case prepMckinseyTbl!CurrentCompetitiveState
            Case "Competitive Advantage"
                Select Case prepMckinseyTbl!GoalCompetitiveState
                    Case "Competitive advantage"
                        assessmentTbl!BusinessAlignment = "H"
                    Case "Competitive Par"
                        assessmentTbl!BusinessAlignment = "L"
                    Case "Competitive Disadvantage"
                        assessmentTbl!BusinessAlignment = "L"
                    Case Else
                        assessmentTbl!BusinessAlignment = ""
                End Select
           
              
             Case Else    ' Other values.
                assessmentTbl!BusinessAlignment = ""
        End Select
    End If
    assessmentTbl.Update ' Save the contents of the copy buffer to disk
    healthTbl.MoveNext ' Make the next record the current record
Loop
End Sub



PLEASE SOMEBODY HELP?
 
Last edited by a moderator:
Back
Top