Results 1 to 9 of 9
  1. #1
    Yawar is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2021
    Posts
    4

    Holder of Field

    Sir(s) I have a problem with ms access form. which is I want to hold the date field by checkbox i.e for batch data entry I have to hold the same date for 30 or 40 entries of previous dates and so on. after every entry i have to specify the old date which takes the much time. Plz sir can you tell me any solution for hold the date which specified by me if I checked the checkbox.




    Best Regards


    Ghulam Yawar Abbas

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Many ways you could do this.
    If you are opening the form from another form you could prompt for the date (Input Box), assign that date to the form's OpenArgs property and as long as the box is checked, each new record could get the date from the OpenArgs property.

    You could open the form, enter the date in an unbound textbox then check the box. This could then set the bound control to that date for each new record. If you alter the date, the next record would get the new date if the box is checked.

    You could check the box, prompt for a date, set a variable to that date at the form module level and set the bound control to that date for each new record.

    You could get the value of the date from the 1st record in the form BeforeUpdate event and pass it to a form module level variable. Then get the variable value and assign it to the date control for the next new record.

    Probably 50 other ways to do this. Trick is to choose the right event and perform the correct test(s) and that all depends on the form design and your preferences. I'd say that the Current event must be involved because that's where you must check if it is a new record first, otherwise you could alter the date as you move from record to record.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Yawar is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2021
    Posts
    4
    sir this is sketch what I want exactly?
    Click image for larger version. 

Name:	Untitled.jpg 
Views:	18 
Size:	69.6 KB 
ID:	45427

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    That's what I envisioned.
    I gave you several suggestions on how to accomplish this. If you are looking for step by step instructions, it's too involved to describe here. You must take the suggestion you prefer and implement it. Or you could copy your db, compact the copy, zip it and then post it here for some practical help - if not from me, then from someone else who will jump in while I am off line. It's after 2:30 AM here so I am done for now.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Yawar is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2021
    Posts
    4

    File

    General Ledger.zipSir i am sending file. please open the voucher form

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    This is one way
    http://allenbrowne.com/ser-24.html

    I use the code below in one of my very early DBs and that worked fine, exactly what you are attempting.

    Code:
    Private Sub Date_ID_AfterUpdate()
        If Me.chkCopy Then
            Me![Date_ID].DefaultValue = """" & Me![Date_ID].Value & """"
        Else
            Me![Date_ID].DefaultValue = 0
        End If
    End Sub
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Yawar is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2021
    Posts
    4
    Sir thanks so Much. It works some times and some times not.

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    Code does not change it's mind.
    Walk through the code line by line and inspect the variables/controls or put Debug.Print statements in, to show the value of relevant data, to track down the problem.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    Hi Yawar

    There is no need for the field Date0 in the GeneralLedger table

    You have the Date of the Transaction in your Voucher table

    I changed the Primary Key ID in the Voucher table to VoucherID

    I added a field to the GeneralLedger table named VoucherID which is the related FK to the PK in Voucher Table

    The Voucher table is now Linked Parent to Child using the VoucherID and not the Combination of fields that you were using.

    You should not use Lookup Fields in tables as this is not recommended.

    See the attached example.
    Attached Files Attached Files
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

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

Similar Threads

  1. Replies: 21
    Last Post: 09-29-2017, 01:30 PM
  2. Replies: 0
    Last Post: 09-28-2015, 10:10 PM
  3. Replies: 6
    Last Post: 06-26-2015, 08:55 PM
  4. Replies: 17
    Last Post: 03-16-2014, 10:52 PM
  5. Replies: 3
    Last Post: 12-27-2013, 02:33 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