Results 1 to 9 of 9
  1. #1
    Gezza is offline Novice
    Windows XP Access 2002
    Join Date
    Sep 2010
    Posts
    12

    Losing information from a text box

    Hi,

    I have a textbox on a form, control source is
    "=DLookUp("[qry_ActionEmployee]![Name]","[qry_ActionEmployee]"," qry_ActionEmployee]![Payroll No]= [A_Employee_ID] ")".

    When I run some VB code related to the form but not the textbox it returns a value of null? in the textbox.


    Before the code is run the value is ok. I have tried using ".Requery" of the textbox in the code but has not worked.

    Any help would be much appreciated

    Gezza

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    Is [A_Employee_ID] supposed to be a value supplied by the form? If so, don't include within quotes, concatenate the variable. The expression isn't really within quotes in the ControlSource, is it?
    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
    Gezza is offline Novice
    Windows XP Access 2002
    Join Date
    Sep 2010
    Posts
    12
    This is how it is typed in the control box.
    =DLookUp("[qry_ActionEmployee]![Name]","[qry_ActionEmployee]"," qry_ActionEmployee]![Payroll No]= [A_Employee_ID] ")
    Yes [A_Employee_ID] is a value supplied by the form.
    If I remove the quotes from the variable as it is type above it does not work. How do I concatenate it?

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

    =DLookUp("[qry_ActionEmployee]![Name]","[qry_ActionEmployee]"," qry_ActionEmployee]![Payroll No]='" & [A_Employee_ID] & "'")

    If A_Employee_ID is a number, remove the apostrophe delimiters.
    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
    Gezza is offline Novice
    Windows XP Access 2002
    Join Date
    Sep 2010
    Posts
    12
    Have tried that but it's given me a syntax error.
    The original variable works on the form, I'm getting the result I need but once the VB code is run the value in this text box and one other returns Null. No other text boxes on the form seem to be effected?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    Need to see the code. Do you want to provide project?
    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.

  7. #7
    Gezza is offline Novice
    Windows XP Access 2002
    Join Date
    Sep 2010
    Posts
    12
    I can provide project, but don't know how?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    Make copy, remove confidential data, run Compact & Repair, zip if large, attach to post. The Attachment Manager is below the Advanced post editor.
    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.

  9. #9
    Gezza is offline Novice
    Windows XP Access 2002
    Join Date
    Sep 2010
    Posts
    12
    I think I have solved the problem, I have reset the focus on the Form and then re-queried the Text Box. This has worked.

    Thanks June7 for your help. Much appreciated

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

Similar Threads

  1. losing data
    By semicolan1 in forum Access
    Replies: 7
    Last Post: 01-04-2012, 04:41 PM
  2. Losing my Mind: developer tab
    By silverspr in forum Access
    Replies: 2
    Last Post: 12-27-2011, 12:35 PM
  3. Replies: 2
    Last Post: 05-06-2011, 02:00 PM
  4. OrderBy Losing Criteria
    By P5C768 in forum Forms
    Replies: 1
    Last Post: 01-21-2011, 01:07 PM
  5. tables keep losing primary key
    By lwwilliam in forum Access
    Replies: 1
    Last Post: 10-18-2010, 11:36 AM

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