Consulting

Results 1 to 2 of 2

Thread: How to replace multiple DLookups with stored procs in SQL

  1. #1

    How to replace multiple DLookups with stored procs in SQL

    I am moving access qrys to stored procs in sql server. Any recomendations on how i should handle the DLOOKUP function ?
    Any help on how should I replace all the below DLookups with single stored proc with output parameters.

    Private Sub Borrower_Exit(Cancel As Integer)
    txtBorrowerCo = DLookup("CompanyNo", "LenderBorrower", "Name= Forms!frmLoanCreation!Borrower")
    txtBorrowerID = DLookup("ID", "LenderBorrower", "Name= Forms!frmLoanCreation!Borrower")
    txtBorrowerLocation = DLookup("Location", "LenderBorrower", "Name= Forms!frmLoanCreation!Borrower")
    txtBorrowerSignee = DLookup("Signee", "LenderBorrower", "Name= Forms!frmLoanCreation!Borrower") '**** 991020
    txtBorrowerTitle = DLookup("SigneeTitle", "LenderBorrower", "Name= Forms!frmLoanCreation!Borrower") '**** 991020
    Child14.Requery
    End Sub

    Also, could you please explain what Requery does?
    In 'Child14.Requery', Child14 refers to a gird

  2. #2
    VBAX Mentor
    Joined
    Feb 2009
    Posts
    447
    Location
    It's unclear why you want to use a stored procedure to replace DLookup(). Seems to me those could continue to work as written with LenderBorrower as a link to the SQL Server table.

    Or, since you're pulling 5 values from LenderBorrower all based on the same condition, you could pull them from a recordset based on a query which returns CompanyNo, ID, Location, Signee, and SigneeTitle for a Name which matches Forms!frmLoanCreation!Borrower

    Look at the Access help topic for the Requery method to find out what it does.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •