Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DLookp (Access 2000)

    Something is wrong with my DLookup expression. It is not right what i have done. Can you help me do it straight?

    DoCmd.TransferDatabase acImport, "Microsoft Access", appath, acTable, "DLookUp("UniID", "Uni", "ACCEPTED = True")" , "Unis"

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: DLookp (Access 2000)

    Are you sure the DLookup will always return a valid string? If so, take the quotes out from around the DLookup and use this instead

    <code>DoCmd.TransferDatabase acImport, "Microsoft Access", appath, acTable, DLookUp("UniID", "Uni", "ACCEPTED = True") , "Unis"</code>

    Otherwise, you should do something like this:

    <code>Dim strTable As String

    strTable = Nz(DLookUp("UniID", "Uni", "ACCEPTED = True") )
    If Len(strTable)>0 then
    DoCmd.TransferDatabase acImport, "Microsoft Access", appath, acTable, DLookUp("UniID", "Uni", "ACCEPTED = True") , "Unis"
    End If</code>
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DLookp (Access 2000)

    Yes, as Charlotte points out, the problem is with the quote marks. For more info on referring to strings within strings correctly, see <post:=230,516>post 230,516</post:>.
    Waggers
    If at first you do succeed, you&#39;ve probably missed something.

Posting Permissions

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