Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: The user had a request:

    The user had a request:

    I have command button that print many envelops. When you click this button, it will ask you to enter the date start and the date end, then it will print the envelop that has the name on it.
    Now the thing is that the user want to have a field called date that will record the date of the envelop printed out. This field will be added in individual record. Anybody has idea, when the envelops printed out, the date of today will be displayed on the date field in each record that has been retrieved from the Command button. I am not sure whether it is clear or not, I need it done soon. Thanks.

  2. #2
    Join Date
    Sep 2004
    Location
    Tampa, FL
    Posts
    520
    Have the OK button on your date form also run an update query based on the same criteria your date input form uses.
    Darasen

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    Thanks you very much! I knew how to run the update query. But i can write a code to run.

    DoCmd.OpenReport "rptRenewals", acViewPreview

    How to write a code that can run the update query.

    Thanks Again!

  4. #4
    Join Date
    Mar 2004
    Posts
    660
    Thanks, i got, the code is "openquery". But there has message asks user that will update the record. Can i delete this message, so that the user doesn't need to know. Thanks.

  5. #5
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    This should do it:

    Docmd.SetWarnings False
    Docmd.OpenQuery ....
    Docmd.SetWarnings True
    Inspiration Through Fermentation

  6. #6
    Join Date
    Mar 2004
    Posts
    660
    Thanks. I just found out, When i click the button, I need to open a report and updated query. So the user has to be type the date(start date and end date) twice. How to avoid it. When the user type the date in the first time for the report, it will use the same date for the update query. Thanks.

  7. #7
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Here's how I would do it:

    ...
    varStartDate = InputBox("Enter the start date")
    'make sure the user put in a valid date
    varEndDate = InputBox("Enter the End date")
    'make sure the user put in a valid date

    'add a new row to your print date table
    strSql = "Insert into tblDates (RunDate) Values (#" & CDate(varStartDate) & "#)"
    Docmd.SetWarnings False
    Docmd.RunSql strSql
    Docmd.SetWarnings True

    'print the envelope
    strWhere = "rptDate Between #" & Cdate(varStartDate) & "# and #" & Cdate(varEndDate) & "#"
    Docmd.OpenReport "Envelopes", acViewNormal, strWhere
    Inspiration Through Fermentation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •