Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    28

    Unhappy Unanswered: dlookup or any search

    Hi,
    i want to find infrom in from i am use access 1997. i will populate to field
    to find last field.
    ex.
    I will enter the idno in id text and name in name text i want to show
    the address on .

  2. #2
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133
    Muzori,

    if I understand your question correctly, you want to automatically fill address fields based on a name and id number. The following code will do this. Put this code in an event procedure ("OnExit" for example). I hope this is what you need.

    Dim db As Database
    Dim rst As Recordset
    Dim strSQL As String

    Set db = CurrentDb()
    ' assign the SQL statement to retrieve address
    strSQL = "SELECT MyTable.address, " _
    & " FROM MyTable Where [idno] In(" & Me![idno text] & _
    ") And [name] In(" & Me![name text] & ");"
    Set rst = db.OpenRecordset(strSQL)
    rst.MoveFirst
    ' assign the values to fields on the form
    Me![address] = rst![address]

    rst.Close
    Set db = Nothing

    SteveH

  3. #3
    Join Date
    May 2002
    Posts
    28

    Unhappy why not work

    Hi
    thank alot for u , but not work so can i post my mdb to u and to sulve
    my problem .I f you agree plz post u e-mail address i will send to u
    my file.
    Thanks alot.
    Attached Files Attached Files

Posting Permissions

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