Results 1 to 2 of 2
  1. #1
    mrl is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    5

    help needed! for data entry form using date

    I’m looking for suggestions on the best way to achieve the following ;



    The database contains a single table to record daily sales data.
    One record per date is allowed – so the date field is set as the pk.


    The user wants to enter the sales data using form by selecting the date, (using the date picker as per the date control on the form - Access 2007)

    When the user selects a date using the date picker on the form there are two options;
    a) Data has already been recorded for the selected date – so the form should populate with the existing record – the user can edit the record if required.


    b) No Data has been recorded for the selected date – so the form should display a blank (new) record so the new data can be entered and saved for the selected date.


    I know i can easily make a form to display all of the records using the record selector but the user wants to use the date picker to select records.

    I’m not sure if the form’s record source should be the table or a query based on the table ( should i be using a sub form?); ( VBA beginner level).

    Thanks for any suggestions/help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    One way to accomplish:

    Have an unbound date picker textbox to select date key value. Set form Filter property to: [date primary key fieldname] = Forms!formname!textboxname. Set FilterOnLoad property to Yes. Use AfterUpdate event of the textbox to run code to Requery the form after date selected in textbox. I would use VBA. Set the AfterUpdate property to [Event Procedure]. Double click the ellipses (...) to go to the VBA procedure. Type Me.Requery in the procedure.

    The date for the new record will have to be entered into a textbox bound to the field. Could set this box DefaultValue to: Date(). This will automatically record the current date into the field. If you want this field to take the date entered in the unbound textbox, will need more code in the AfterUpdate event:

    If IsNull(Me.datefieldname) Then Me.datefieldname = Me.textboxname
    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. Form for Data Entry
    By cherkey in forum Forms
    Replies: 4
    Last Post: 02-15-2011, 02:40 PM
  2. Error Message re: data entry of date
    By Pro-not in forum Access
    Replies: 9
    Last Post: 10-22-2010, 10:14 AM
  3. Date/Time entry field on a form
    By Ted C in forum Forms
    Replies: 1
    Last Post: 06-22-2010, 12:28 PM
  4. date entry on input form
    By dzawicki in forum Forms
    Replies: 3
    Last Post: 12-25-2009, 08:13 AM
  5. Automatic Data Entry on a Specific Date
    By alanbrai in forum Programming
    Replies: 2
    Last Post: 11-14-2007, 05:15 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