Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Access (https://www.askmehelpdesk.com/forumdisplay.php?f=441)
-   -   Search for visitor,if exists,use data,else,enter? (https://www.askmehelpdesk.com/showthread.php?t=221044)

  • May 29, 2008, 08:12 AM
    mmu01891
    Search for visitor,if exists,use data,else,enter?
    When visitor comes,I enter their ID,if he/she exists,I enter a new record for her visit using the details already in the database.

    But if he/she does not exist in the database,want to be able to enter his/her details in the visitor s details form and then after that,enter the details of his or her visit in the visitDetails form.

    In other words,I have 2 forms,visitDetails which stores details of a visitor s visit such as timeIn,timeOut and natureOfVisit,the other form is visitorDetails which stores information about the visitot such as name,ID,surname,placeOfResidence.

    I also have a query which prompts the user to enter the visitor 's ID,if a match is found,I want to be taken to the visitDetails to enter a new visit record for a visitor whose personal details already exist.
    And if a match is not found,I want to be taken to the visitorDetails to enter personal details of a visitor and the to the visitDetails form to enter a new visit record for him/her.

    Thank for any help!
  • May 29, 2008, 08:25 AM
    ScottGem
    In the After Update event of the control where you enter the Visitor ID add code like:

    If Not IsNull(DLookup("[VisitorID]","tblVistors"."[VisitorID] = " & Me.txtVisitorID)) Then

    DoCmd.OpenForm "frmNewVisit"

    Else

    Docmd.OpenForm "frmNewVisitor"

    End If

  • All times are GMT -7. The time now is 12:45 AM.