: : I Am Using SQL Alot In A Project, But For Some Reason I Feel I'm Doing Way More Work Then I Have To. Curently, I Am Storing Variables By Checking Each Field, Then Storing Accordingly.
: :
: :
: : Do Until rs.EOF
: : EmpSum.CurRec = EmpSum.CurRec + 1
: : CmdEdit(EmpSum.CurRec).Visible = True
: : For Each fld In rs.Fields
: : If fld.Name = "11a" Then
: : EmpSum.SumHours(1, 1, 1) = fld.Value
: : ElseIf fld.Name = "12a" Then
: : EmpSum.SumHours(1, 2, 1) = fld.Value
: : ElseIf fld.Name = "13a" Then
: : EmpSum.SumHours(1, 3, 1) = fld.Value
: : ElseIf fld.Name = "14a" Then
: : EmpSum.SumHours(1, 4, 1) = fld.Value
: : End If
: : Next
: : Loop
: :
: :
: : There Must Be An Easier Way To Do This Then To Check The Field Name For Every Record.
: :
: : Any Ideas Would Be Appreciated.
: :
:
:
: Have you considered referencing each field directly? ie:
:
:
: Do Until rs.EOF
: EmpSum.CurRec = EmpSum.CurRec + 1
: CmdEdit(EmpSum.CurRec).Visible = True
:
: EmpSum.SumHours(1, 1, 1) = rs!11a
: EmpSum.SumHours(1, 2, 1) = rs!12a
: EmpSum.SumHours(1, 3, 1) = rs!13a
: EmpSum.SumHours(1, 4, 1) = rs!14a
: rs.MoveNext
: Loop
:
:
:
Yes I Have, I Just Didn't Know How To Go About It In VB. I've Done It In PHP, So That's Why I Was Wondering If I Could Do It In VB. Thanks Alot.