[AccessD] Importing from Excel

Hale, Jim Jim.Hale at FleetPride.com
Thu Jul 26 15:22:01 CDT 2007


Using offset you can "walk" a spreadsheet to create a record applying
different tests to the cell as needed:
Jim Hale

Do While Not IsEmpty(ActiveCell)
    rstbase.AddNew 'create records in output table
    For x = 0 To 16
    If x < 4 Then rstbase.Fields(x) = .ActiveCell.Offset(0, x)
        'change sign on Jan-Dec revenue
        If x > 3 Then
        If rstbase.Fields("rptline") = 4100 Then
            rstbase.Fields(x) = -Round(.ActiveCell.Offset(0, x), 3)
        ElseIf rstbase.Fields("rptline") = 4110 Then
            rstbase.Fields(x) = -Round(.ActiveCell.Offset(0, x), 3)
        ElseIf rstbase.Fields("rptline") = 4120 Then
            rstbase.Fields(x) = -Round(.ActiveCell.Offset(0, x), 3)
        ElseIf rstbase.Fields("rptline") = 4130 Then
            rstbase.Fields(x) = -Round(.ActiveCell.Offset(0, x), 3)
        ElseIf rstbase.Fields("rptline") = 15000 Then
           rstbase.Fields(x) = Round(.ActiveCell.Offset(0, x), 3)
        Else
             rstbase.Fields(x) = Round(.ActiveCell.Offset(0, x), 3)
        End If
    End If
        
    Next x
    If Not rstbase.Fields("rptline") = 0 Then rstbase.Update
    


***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.




More information about the AccessD mailing list