Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    smarty84handsome is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    67

    Smile Display something from table

    Can someone tell me how do i write down the code in order for something to be displayed on my report. I have employee_Table in which i have employee_name and employee_number and in my report i want to create a report in such a way that everytime i type someone employee_name i want their employee_number to be displayed automatically.

    (PLS NOTE I WANT TO DO THIS WITHOUT COMBO BOX) i want someone to show me what will be code ?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Don't understand what you want. If the report is bound to the table and textboxes bound to fields, the data should be showing on report. Explain more what you are trying to do.
    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
    smarty84handsome is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    67
    Well i had created text box emp_name & emp_Id now i have parameter in both the fields with employee name = [employee_name] and with employee id = [employee_number] now the problem is everytime i generate a report there will be a parameter asking me which employee name i want to generate report for ? and then it ask me to input employee Id what i am trying to do is once i put employee name in parameter employee number should populate automatically.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    You have input parameters set in report's RecordSource? Access is not finding name so it prompts for input.

    Provide project for analysis and I will look at.
    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
    smarty84handsome is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    67
    Quote Originally Posted by June7 View Post
    You have input parameters set in report's RecordSource? Access is not find name so it prompts for input.

    Provide project for analysis and I will look at.
    I can't attach the file coz its too big how do I provide u with details u r right I have parameters set in record source and tht is why it is asking to input details before even I generate report. Project has Table: employee_file with list of employee_name & their corresponding EMPLOYEE_number now while generate a report for particular employee I want to see their employee number automatically on the report as mentioned before I have setup record source in such a way that everytime I generate report for particular employee their employee number should show automatically and for this I have created text box with record source [employee_number] what I wanna do is instead of setting parameter employee Id should show employee_number automatically how do I map record source to the table without using parameter method?

  6. #6
    smarty84handsome is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    67
    Quote Originally Posted by June7 View Post
    You have input parameters set in report's RecordSource? Access is not find name so it prompts for input.

    Provide project for analysis and I will look at.
    Or is it coz my primary key is SR_No ?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    How big? Did you run Compact & Repair? Zip it if large (2mb zip allowed). If still too big can upload to fileshare site such as box.com and post link to file.

    If you are trying to filter report to a specific employee, parameter has be to provided somehow. There are several approaches to this.

    1. Input parameter prompt in query
    I never use this method. Cannot validate user input.

    2. Input parameter by reference to controls on form.
    I seldom use this method.

    3. Parameters input into form control passed to form or report with WHERE CONDITION of DoCmd.OpenForm (or OpenReport). I use this most often and I use only VBA, not macros, but I think macros can also do this.
    DoCmd.OpenReport "report name", , , "Employee_ID=" & Me.formcontrolname
    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.

  8. #8
    smarty84handsome is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    67
    As you can see i don't like inputting parameter as well let me try Docmd in VBA usind Buildevent

  9. #9
    smarty84handsome is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    67
    Okay once i click code event in "click" and i modified the code as

    DoCmd.OpenReport "Discprepancy_report", , , "Employee_ID=" & Me.formcontrolname

    am i missing something it's giving me error saying "INVALID ME"

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    It isn't clear exactly what you are trying to do.
    Do you want to enter an employee number and only report that employee?
    Why do you want parameters?

    You could have a Form, and select employees etc to be reported; then a button to run the report using the "selected employees as part of the recordsource". (June7's option 3)

    What exactly are you trying to accomplish?

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    I don't know the name of your field or control so my example shows a generic "Employee_ID=" & Me.formcontrolname

    Use the actual name of your field and form control.

    Where are you putting this code?

    Going in circles. Provide your project for analysis.
    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.

  12. #12
    smarty84handsome is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    67
    sir the reason i can't share the info is coz it's highly secured information in the data

  13. #13
    smarty84handsome is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    67
    okay here is where i am putting this code,

    Open Repord Design View--->Emp ID (Label)--->Build Event (Code Builder) and in VBA mode on top left it says "TEXT39" and right hand part says "Click"

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Sounds like you might be in the VBA code editor but not sure what you are describing. The code would go behind a form not a report.

    Don't care about data. Make copy, remove confidential data, a single dummy record can be helpful.
    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.

  15. #15
    smarty84handsome is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    67

    Smile

    Quote Originally Posted by June7 View Post
    Sounds like you might be in the VBA code editor but not sure what you are describing. The code would go behind a form not a report.

    Don't care about data. Make copy, remove confidential data, a single dummy record can be helpful.

    Sir/Mam don't what it is but everytime i go through with you in this forum and i find solution myself. I guess u have a magic thouch i solved my problem and it's working perfectly. I appreciate your help.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 07-24-2012, 07:50 PM
  2. Search in a table and display subform
    By smahdih in forum Access
    Replies: 2
    Last Post: 10-29-2011, 01:46 PM
  3. Replies: 3
    Last Post: 08-18-2011, 07:31 AM
  4. how to display a table into vba forms?
    By sunny in forum Access
    Replies: 1
    Last Post: 07-11-2010, 04:33 AM
  5. Display table on a form
    By vCallNSPF in forum Forms
    Replies: 1
    Last Post: 01-17-2010, 08:23 PM

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