Results 1 to 8 of 8

Thread: Dlookup

  1. #1
    Join Date
    Feb 2005
    Posts
    333

    Unanswered: Dlookup

    I'm placing this code in the form load event:
    Code:
    temp = DLookup("p_binp", "opsproj", "p_proj = " & Forms!frmEnvironment!txtProjEnv)
    When this line of code runs I get an error that says "you canceled the previous operation". The criteria evaluates to what I would expect.
    Code:
    MsgBox "p_proj = " & Forms!frmEnvironment!txtProjEnv
    Can this code be ran in the load event? If so, what I am I missing?

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Is Forms!frmEnvironment = Me?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2005
    Posts
    333
    Is Forms!frmEnvironment = Me?
    yup. I've tried this and it doesn't work either
    temp = DLookup("p_binp", "opsproj", "p_proj = " & Me.txtProjEnv)

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    If you know a valid value for Forms!frmEnvironment!txtProjEnv (e.g. 222), what happens if you hard code this into your dlookup?
    Code:
    temp = DLookup("p_binp", "opsproj", _
    "p_proj = 222")
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Feb 2005
    Posts
    333
    Code:
    temp = DLookup("p_binp", "opsproj", "p_proj = farley")
    gets the same error.

  6. #6
    Join Date
    Feb 2005
    Posts
    333
    If I make a query and set the criteria to Forms!frmEnvironment!txtProjEnv and set a break point in the load event then query at the berak point, the query returns an empty set. If I set the criteria to a set value (farly) the query works. Seems like the same would be true for dlookup.

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ah - so p_proj is text? Blimey - you have been in the .NET world for a too long - come on Campster - you know this one!
    Testimonial:
    pootle flump
    ur codings are working excelent.

  8. #8
    Join Date
    Feb 2005
    Posts
    333
    doh. You mean single quotes? Got it. Thanks for the nudge.

Posting Permissions

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