Results 1 to 7 of 7
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    DLookup Bank Information

    I need to lookup from my form the bank being used starting balance. The form has the bank and bankid on it.


    table where data is stored is TBanks field to lookup is startingbalance

    I need it to show the matching bank & id on the form:
    Example; Bank name is Bank of America with a bankid of 14 which is it's primary key.

    Form is named FReg and has the bank and bankid on it.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Sounds simple enough.

    DLookup("startingbalance","TBanks","bankid=" & [bankid])
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Me.Combo97.DefaultValue = DLookup("startingbalance", "TBanks", "bankid = ' bankid'")
    DLookup("startingbalance", "TBanks", "bankid=" & [bankid]) = Me.Combo97

    Do I put this in the OnCurrentEvent or as the control source of the field? And Which one? Combo97 which is a textbox is where I need the value to be.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    DLookup could be the ControlSource for a textbox or could construct field in query. Makes no sense with a combobox.

    bankid is a text field?
    DLookup("startingbalance", "TBanks", "bankid = '" & [bankid] & "'")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Here is a screenshot of the error message i get

    Let's try this another way. I have a command button on the form that I am trying to use to open a form that has this data and link it by bankid to the form I am on.
    This form has what I need to see and it has the same bank and bankid as the form I am on. Error message is this when I try and open it?


    On Error GoTo Err_bankdetails_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "BankBalanceDetails"

    stLinkCriteria = "[bankid]=" & Me![bankid]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_bankdetails_Click:
    Exit Sub

    Err_bankdetails_Click:
    MsgBox Err.Description
    Resume Exit_bankdetails_Click
    Attached Thumbnails Attached Thumbnails bankiderrormessage.jpg  

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Is bankid a text or number field?

    That image shows the form is open so is the error result of expression in query or the VBA code?

    A 'startingbalance' field also doesn't make sense to me. The initial balance of a check register should be the very first deposit. The 'startingbalance' for each month would be the net value of all previous deposits and withdrawals.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I just now solved it, sorry for the confusion! The code was behind a command button. As it is now. Many Thanks,,,
    stDocName = "BankBalanceDetails"

    stLinkCriteria = "[Bank]=" & "'" & Me![Bank] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 12-25-2012, 12:43 AM
  2. Reconcile bank statement
    By Ray67 in forum Database Design
    Replies: 1
    Last Post: 04-10-2012, 09:43 PM
  3. Bank passbook printing
    By evander in forum Reports
    Replies: 3
    Last Post: 10-01-2011, 05:53 AM
  4. Bank account catagories
    By broecher in forum Database Design
    Replies: 1
    Last Post: 10-16-2010, 10:21 PM
  5. How to create an Exam Question Bank
    By yus786 in forum Database Design
    Replies: 1
    Last Post: 02-04-2010, 08:48 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums