[AccessD] Msadodc.ocx - or not

rosalyn.clarke at barclays.com rosalyn.clarke at barclays.com
Mon Mar 10 12:30:01 CDT 2008


 
Hi all

I have a bunch of Access databases I need to migrate from a local environment
at one of my client's offices to their new standardised citrix environment.
The developers have made liberal use of msadodc.ocx controls, but this
control is not included in the new environment. 

I've never used an active x data control so I'm not sure what I'm losing by
ditching these. Is there a performance benefit to using the data control?

Sample of how it's used below (long - please snip if responding!!)

TIA

Roz
x

rivate Sub cmdSBITable_Click()
Dim cmd As New ADODB.Command
Dim rstCharges As New ADODB.Recordset
Dim dbs As Database
Dim strPath As String

Set dbs = CurrentDb
strPath = dbs.Name

Screen.MousePointer = 11

With ADODC1
    .ConnectionString = "Provider=MSDAORA.1;Password=bbcc_dba; " _
    & "User ID=bbcc;Data Source=cscs;Persist Security Info=True"
    .CursorLocation = adUseClient
    .CursorType = adOpenStatic
End With


With ADODC2
    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; " _
    & "Data Source=" & "s:\access\chaps\chaps.mdb" & ";Persist Security
Info=False"
    .CursorLocation = adUseClient
    .CursorType = adOpenStatic
End With


' Vat Payable
With cmd
    .ActiveConnection = ADODC2.ConnectionString
    .CommandText = "SELECT QryCustomerRegistration.ChargingSortCode,
QryCustomerRegistration.ChargingAccountNo, " _
    &
"([QuarterlyNetBTCharge]+[QuarterlyNetCATCharge]+[QuarterlyNetPADCharge]+[Add
itionalCharge])+(([QuarterlyNetBTCharge]+" _
    &
"[QuarterlyNetCATCharge]+[QuarterlyNetPADCharge]+[AdditionalCharge])/100*[VAT
Rate]) AS TotalQuarterlyCharge " _
    & "FROM (((TblVATRequired INNER JOIN QryCustomerRegistration ON
TblVATRequired.VATRequired = QryCustomerRegistration.VATRequired) " _
    & "INNER JOIN TblPadCharge ON QryCustomerRegistration.PadChargeLU =
TblPadCharge.PadChargeLU) " _
    & "INNER JOIN TblCatCharge ON QryCustomerRegistration.CatChargeLU =
TblCatCharge.CatChargeLU) " _
    & "INNER JOIN TblBTCharge ON QryCustomerRegistration.BTChargeLU =
TblBTCharge.BTChargeLU " _
    & "WHERE (((QryCustomerRegistration.PaymentMethod) <> 'Cheque') And
((QryCustomerRegistration.VATRequired) = 'Full') " _
    & "And ((([QuarterlyNetBTCharge] + [QuarterlyNetCATCharge] +
[QuarterlyNetPADCharge] + [AdditionalCharge]) + " _
    & "(([QuarterlyNetBTCharge] + [QuarterlyNetCATCharge] +
[QuarterlyNetPADCharge] + [AdditionalCharge]) / 100 * [VATRate])) > 0) " _
    & "And ((QryCustomerRegistration.ChargeCustomer) = Yes)) " _
    & "ORDER BY QryCustomerRegistration.CustomerName; "
    .Execute
End With
Set rstCharges = cmd.Execute
rstCharges.MoveFirst

Do Until rstCharges.EOF = True
    
    strErrorMessage = ""
    ModulusCheck rstCharges(0).Value, rstCharges(1).Value
    CheckSortCode rstCharges(0).Value

    If strErrorMessage = "" Then 'record is OK
        With cmd
            .ActiveConnection = ADODC1.ConnectionString
            .CommandText = "INSERT INTO sbi_t_data (Sort_Code,
Account_Number, sec_code, total, valid_flag) " _
            & "VALUES ('" & rstCharges(0).Value & "', '" &
rstCharges(1).Value & "', '506', '" & rstCharges(2).Value * 100 & "', '0') "
            .Execute
        End With
    Else 'Mod 10 or Sort Code failure. Write to table with a failed flag
        With cmd
            .ActiveConnection = ADODC1.ConnectionString
            .CommandText = "INSERT INTO sbi_t_data (Sort_Code,
Account_Number, sec_code, total, valid_flag) " _
            & "VALUES ('" & rstCharges(0).Value & "', '" &
rstCharges(1).Value & "', '506', '" & rstCharges(2).Value * 100 & "', '1') "
            .Execute
        End With
    End If
    
    rstCharges.MoveNext

Loop

rstCharges.Close

' Vat Not Payable
With cmd
    .ActiveConnection = ADODC2.ConnectionString
    .CommandText = "SELECT QryCustomerRegistration.ChargingSortCode,
QryCustomerRegistration.ChargingAccountNo, " _
    &
"([QuarterlyNetBTCharge]+[QuarterlyNetCATCharge]+[QuarterlyNetPADCharge]+[Add
itionalCharge])+(([QuarterlyNetBTCharge]+" _
    &
"[QuarterlyNetCATCharge]+[QuarterlyNetPADCharge]+[AdditionalCharge])/100*[VAT
Rate]) AS TotalQuarterlyCharge " _
    & "FROM (((TblVATRequired INNER JOIN QryCustomerRegistration ON
TblVATRequired.VATRequired = QryCustomerRegistration.VATRequired) " _
    & "INNER JOIN TblPadCharge ON QryCustomerRegistration.PadChargeLU =
TblPadCharge.PadChargeLU) " _
    & "INNER JOIN TblCatCharge ON QryCustomerRegistration.CatChargeLU =
TblCatCharge.CatChargeLU) " _
    & "INNER JOIN TblBTCharge ON QryCustomerRegistration.BTChargeLU =
TblBTCharge.BTChargeLU " _
    & "WHERE (((QryCustomerRegistration.PaymentMethod) <> 'Cheque') And
((QryCustomerRegistration.VATRequired) = 'Exempt') " _
    & "And ((([QuarterlyNetBTCharge] + [QuarterlyNetCATCharge] +
[QuarterlyNetPADCharge] + [AdditionalCharge]) + " _
    & "(([QuarterlyNetBTCharge] + [QuarterlyNetCATCharge] +
[QuarterlyNetPADCharge] + [AdditionalCharge]) / 100 * [VATRate])) > 0) " _
    & "And ((QryCustomerRegistration.ChargeCustomer) = Yes)) " _
    & "ORDER BY QryCustomerRegistration.CustomerName; "
    .Execute
End With
Set rstCharges = cmd.Execute
rstCharges.MoveFirst

Do Until rstCharges.EOF = True
    
    strErrorMessage = ""
    ModulusCheck rstCharges(0).Value, rstCharges(1).Value
    CheckSortCode rstCharges(0).Value

    If strErrorMessage = "" Then 'record is OK
        With cmd
            .ActiveConnection = ADODC1.ConnectionString
            .CommandText = "INSERT INTO sbi_t_data (Sort_Code,
Account_Number, sec_code, total, valid_flag) " _
            & "VALUES ('" & rstCharges(0).Value & "', '" &
rstCharges(1).Value & "', '506', '" & rstCharges(2).Value * 100 & "', '0') "
            .Execute
        End With
    Else 'Mod 10 or Sort Code failure. Write to table with a failed flag
        With cmd
            .ActiveConnection = ADODC1.ConnectionString
            .CommandText = "INSERT INTO sbi_t_data (Sort_Code,
Account_Number, sec_code, total, valid_flag) " _
            & "VALUES ('" & rstCharges(0).Value & "', '" &
rstCharges(1).Value & "', '506', '" & rstCharges(2).Value * 100 & "', '1') "
            .Execute
        End With
    End If
    
    rstCharges.MoveNext

Loop

rstCharges.Close



Screen.MousePointer = 0
MsgBox "SBI Billing run complete. Please inform Infrastructure Support",
vbOKOnly, "SBI Billing"



End Sub

This e-mail and any attachments are confidential and intended solely for the addressee and may also be privileged or exempt from disclosure under applicable law. If you are not the addressee, or have received this e-mail in error, please notify the sender immediately, delete it from your system and do not copy, disclose or otherwise act upon any part of this e-mail or its attachments.

Internet communications are not guaranteed to be secure or virus-free.
The Barclays Group does not accept responsibility for any loss arising from unauthorised access to, or interference with, any Internet communications by any third party, or from the transmission of any viruses. Replies to this e-mail may be monitored by the Barclays Group for operational or business reasons.

Any opinion or other information in this e-mail or its attachments that does not relate to the business of the Barclays Group is personal to the sender and is not given or endorsed by the Barclays Group.

Barclays Bank PLC.Registered in England and Wales (registered no. 1026167).
Registered Office: 1 Churchill Place, London, E14 5HP, United Kingdom.

Barclays Bank PLC is authorised and regulated by the Financial Services Authority.




More information about the AccessD mailing list