Results 1 to 10 of 10

Cannot register value to table

  1. #1
    nasps is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Oct 2019
    Posts
    8

    Cannot register value to table

    Hello all



    First of all, I hope to learn and help - within my knowledge - whenever I can here in this forum.

    Secondly, I assume myself as a "newbie" in Access because I know Access, I just haven't used almost since I've left college (looooong time ago).

    So here's the deal: I'm making a very simple db to register employees time relative to the projects they work during the day.
    I have a table with the employees info tblEmployee (ID, Name, email, username, password), a table with the projects info tblProjects (ID, name)and a table tblRecord (ID, EmployeeName, Project, Date, nr_hours) with the records itself. Very few little fields for now.
    I've made a form based on the tblRecord and I've managed to get the projects table information to be well selected for a proper register.
    The problem relies on the employee name. I'll explain:
    I've made a small login form with username and password and I can fairly pass the username info through the Register form so that when that user registers a new record his name (EmployeeName) is already filled. Problem: despite the form has all the info to record in tblRecord, the name is blank. I've turned my head around and I cannot see the probelm. If I let the textbox available - write in it - it records fine. If I let that text box with a value that comes from login - view only - The record of the name is blank.

    Might be something completely stupid but honestrly...I'm blocked!

    Any help would be great.
    Thanks in advance

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,232
    Really need to show code for analysis.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    nasps is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Oct 2019
    Posts
    8
    Records.zipHello June7,

    Thanks for your feedback.
    I send the db in attach. Start the frmLogin and then it goes to Records form. test password for all made-up users 123456

    Thanks
    Nuno

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,232
    Suggest should be saving tblEmployees ID primary key into tblRecord instead of username.

    Textbox txtInfoUser is not bound to field. Either bind textbox or use code to set field value before committing record.

    Form is opening to existing record. If you use login info you will modify data in this record. Should probably open form in add mode:

    DoCmd.OpenForm "frmRecord", , , , acFormAdd



    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
    nasps is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Oct 2019
    Posts
    8
    Quote Originally Posted by June7 View Post
    Suggest should be saving tblEmployees ID primary key into tblRecord instead of username.

    Textbox txtInfoUser is not bound to field. Either bind textbox or use code to set field value before committing record.

    Form is opening to existing record. If you use login info you will modify data in this record.

    I believe that might be it. Any thoughts on how to bind textbox best procedure? My initial thought was to create a global varialbe withe the username info as the login form is closed upon login.

    Thanks

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,232
    Global variable is certainly one way to pass value between forms. Just keep in mind they lose value if code execution is interrupted by run-time error. This can be annoying when debugging code.

    Bind textbox by setting ControlSource property in Design view.
    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
    nasps is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Oct 2019
    Posts
    8
    Quote Originally Posted by June7 View Post
    Global variable is certainly one way to pass value between forms. Just keep in mind they lose value if code execution is interrupted by run-time error. This can be annoying when debugging code.

    Bind textbox by setting ControlSource property in Design view.
    I'm sorry June7, but isn't already the textbox bounded (=[txtInfoUser].[Visible]) ?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,232
    Visibility has nothing to do with linking a control to a field. That's what ControlSource property does. This is basic Access functionality in form and report design.

    That expression doesn't even make sense. Why do you even consider that expression would be relevant?
    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
    nasps is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Oct 2019
    Posts
    8
    Quote Originally Posted by June7 View Post
    Visibility has nothing to do with linking a control to a field. That's what ControlSource property does. This is basic Access functionality in form and report design.

    That expression doesn't even make sense. Why do you even consider that expression would be relevant?
    June7...after some "stone breaking" I've managed to get the Employee name registered everytime I make a new record...Thank you for the enlightment
    In the mean time I was wondering around how would be the best practice to pass the username, givin by the login, throught the entire forms even when the frmLogin is closed.
    Any suggestion?

    Thanks again!

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,232
    Options:

    1. global variable

    2. TempVars - I have never used, will let you research

    3. set a textbox on a form that never closes, such as a MainMenu - this is what I do

    4. set field in a frontend table with only one record, assuming db is split design which a multi-user db should be
    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.

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

Similar Threads

  1. Student Attendance Register
    By faiz786 in forum Access
    Replies: 6
    Last Post: 05-04-2017, 02:56 PM
  2. Trying to build a class register
    By Tommo in forum Access
    Replies: 14
    Last Post: 09-14-2015, 01:58 PM
  3. POS or cash register on a form
    By visidro in forum Access
    Replies: 2
    Last Post: 04-19-2015, 02:17 AM
  4. Duplicate Register
    By maluna in forum Access
    Replies: 1
    Last Post: 09-28-2010, 12:45 AM
  5. Attendency register in a database
    By pp100 in forum Access
    Replies: 2
    Last Post: 08-31-2010, 06:51 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums