Results 1 to 6 of 6
  1. #1
    imintrouble is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    Missouri, where frownin's a sport
    Posts
    127

    modify button

    Hello! I have created a login form, where a user enteres their user name, e-mail, user type (E.G. Student Employee) then, using two other text fields, I entered into the control source property for both, date() for the first to show the date the person was on, and format(Now(),"hh:nn:ss") to display the current time in hours:minutes:seconds. In the table this information is to be entered in, I wish for the date and the time to be put into their respective fields, Date_Worked and Strt_Time.



    I did have a button which used on-click code to take the time and the date from the two text fields on the form and input them into the table as I wished. However this created a new row with only the time and date entered. Trying to get over this problem, I had to make sure that all of the rest of the information, id, username, email, and usertype were also input into the table. Unfortunatly this would not be allowed because the form already enteres the information from these text boxes into their pre-defined fields of the table, causing my code to error out, and only the information besides the date and time to be entered.


    My question is this: Instead of having a log-in button which enteres all of the information, would it be possible to instead have the button modify the row for this particular id/user combination? Or would it be possible to simply use the same onclick code I did before, but instead of using the same control source for the id, username, email, usertype which inputs that information into their default fields of the table, change it to something else, not sure what, but do this so that it will only be my button which takes the information in the form and inputs it to a specified field on the table.

    Any help at all would be most welcome. I've been working on this project for a while and am, quite frankly getting tired of it.
    Last edited by imintrouble; 10-13-2011 at 01:52 PM.

  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,902
    Use the DefaultValue property of textboxes instead of ControlSource to set date and time of new record. Set the ControlSource to the field(s) data should be saved to. If you don't want users to be able to change these values, set Locked property to Yes. No need to 'save' record, just close the form to commit record to table.
    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
    imintrouble is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    Missouri, where frownin's a sport
    Posts
    127
    thank you so much, you have no idea how long this has taken me >.<; Another question that, if asnwered would be useful, is how I can make sure that when someone is done using the database to enter the current time into a field named End_Time. This can be done from when you close the database or when a button is clicked. Thanks again!

  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,902
    Only time, not date? Two ways.

    1. If the form with the button has the End_Time field in its RecordSource and the current record is the one that needs update, simply code in the button Click event: Me!End_Time = Format(Now(),"Medium Time")

    2. Use an UPDATE sql action.
    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
    imintrouble is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    Missouri, where frownin's a sport
    Posts
    127
    two questions, what is a recordsource, and how can i check to see if End_Time is there and how can I change it if it's not there.

  6. #6
    imintrouble is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    Missouri, where frownin's a sport
    Posts
    127
    never mind, i figured it out :P thanks so much, this project is just about done

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

Similar Threads

  1. Modify sample templates?
    By DavesBonnyLass in forum Database Design
    Replies: 19
    Last Post: 05-26-2013, 03:16 AM
  2. Add field to table using VBA and modify it
    By snoopy2003 in forum Programming
    Replies: 5
    Last Post: 07-23-2011, 03:01 PM
  3. Nothing changed when i modify the uid and passwd
    By lianghua19 in forum Database Design
    Replies: 4
    Last Post: 07-14-2011, 02:24 PM
  4. SQL*Plus code in MsAccess, how to modify?
    By suverman in forum Queries
    Replies: 1
    Last Post: 05-20-2011, 07:01 AM
  5. Modify PivotChart Filter VBA
    By Catch Wrestler in forum Programming
    Replies: 1
    Last Post: 06-28-2010, 06:10 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