Results 1 to 5 of 5
  1. #1
    MalvinkaAccess is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    3

    Question Forms and queries

    I have a couple of questions:
    1. If a user enters a loan number into a form, how do I see if the loan number is already in the database and ask the user whether they would like to update the entry, and if yes, then update the existing entry rather than added a new one. How do I do that?

    2. How do I get the previous date before 3pm in the query? (the actual dates in the database would be 1/12/13 15:00 for instance)

    Thanks so much for your help!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    1. use a combobox and code in combobox BeforeUpdate to search the table, VBA code using DLookup like:

    If Not IsNull(DLookup("loanNum", "tablename", "LoanNum=" & Me.comboboxname)) Then
    If MsgBox("Loan exists. Do you want to edit.", vbYesNo) = vbYes Then
    'code to go to existing record or open another form
    Cancel = True
    EndIf
    EndIf

    2. you want latest date prior to 3pm for all records in table or just for the loan number?
    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
    MalvinkaAccess is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    3
    Quote Originally Posted by June7 View Post
    1. use a combobox and code in combobox BeforeUpdate to search the table, VBA code using DLookup like:

    If Not IsNull(DLookup("loanNum", "tablename", "LoanNum=" & Me.comboboxname)) Then
    If MsgBox("Loan exists. Do you want to edit.", vbYesNo) = vbYes Then
    'code to go to existing record or open another form
    Cancel = True
    EndIf
    EndIf

    This isn't working at all Giving me an error about Loan Number (that's the name of it in the table)

    2. you want latest date prior to 3pm for all records in table or just for the loan number?
    Latest date prior to 3pm for all records in the table

    Thanks so much!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Try:

    DMax("datefield","tablename","Hour(datefield)<15")
    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
    MalvinkaAccess is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    3
    Quote Originally Posted by June7 View Post
    Try:

    DMax("datefield","tablename","Hour(datefield)<15")
    Thanks so much!

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

Similar Threads

  1. From queries and tables to forms?
    By Fidycent in forum Forms
    Replies: 4
    Last Post: 12-16-2011, 01:54 PM
  2. Help: queries or forms and which type?
    By phineas629 in forum Access
    Replies: 11
    Last Post: 10-10-2011, 08:40 AM
  3. Forms and SQL Queries
    By springboardjg in forum Queries
    Replies: 1
    Last Post: 06-07-2011, 06:18 AM
  4. Help with Queries and forms
    By dcwang3 in forum Access
    Replies: 0
    Last Post: 05-28-2009, 08:00 AM
  5. Replies: 4
    Last Post: 04-01-2009, 08:49 PM

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