Re: CHECK FIELD FOR PRINTING

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Re: CHECK FIELD FOR PRINTINGJoe,
Thank you very very much for the response and code. WWV
"Joseph R. Pottschmidt" <me@xxxxxxxxxxxxxxxxxx> wrote in message news:00a001c690e8$f3f9e1d0$640fa8c0@xxxxxxxxxxx
Dear Wayne:



Here is what you need to do in order to make what you want to happen in VBA code:

Please make sure in your reference Library to install the Microsoft DAO Library Support in order for the Database options to work. Otherwise it will not show up as a Unknown referenced item in your code.



Sub PrintCoupon()

Dim MyDB As DAO.Database ' Defines a variable as a Database Reference

Dim MyRS As DAO.Recordset ' Defines a variable as a Recordset Reference

Dim Ans As Integer 'Defines a variable to store the answer to question



Set MyDB = CurrentDb() 'Sets the MyDB variable to the current open database.

'Set the MyRS variable with an SQL Statement that will Pull all records that will have an amount >= $50 and allows you to Edit it

Set MyRS = MyDB.OpenRecordset("Coupon", DB_OPEN_DYNASET)

'These next lines of code go through the condition of each record that was true and allows to answer the question if you want to print or not.

Criteria = "AmountField >= 50"

MyRS.FindFirst Criteria

Do While Not MyRS.EOF()

Ans = MsgBox("Do you want to Print Coupon?", vbYesNo, "Printing Coupon")

If Ans = vbYes Then

DoCmd.OpenReport "Coupon", acViewNormal 'This is the report that has your coupon designed with the $50.00 on it.

MyRS.Edit

MyRS!AmountField = MyRS!AmountField - 50

MyRS.Update

MyRS.FindNext Criteria

Else

MyRS.FindNext Criteria

End If



Loop

End Sub


------------------------------------------------------------------------------

From: Wayne Veale [mailto:venterp@xxxxxxxxxxxxxxx]
Posted At: Wednesday, June 14, 2006 8:31 PM
Posted To: microsoft.public.access.macros
Conversation: CHECK FIELD FOR PRINTING
Subject: Re: CHECK FIELD FOR PRINTING


Joe, Sorry it took so long to get back to you but I have been out of town. Please send code on this. I'm an old ex programmer and this has been a frustrating problem for me. I basically want to check a table entry (I know how to identify this) and display a form if the value is in a field >= 50. The form mearly asks if the usr wants to print a report (coupon) or not. This form is created and working on it's own. I did not think it would be a problem shooting a form based on a condition. One problem is if the condition IS met, it seems to work fine, if the condition IS NOT met, the form is displayed with no informations in the fields. Pleeeese help,

WWV

"Joseph R. Pottschmidt" <me@xxxxxxxxxxxxxxxxxx> wrote in message news:006601c68536$b60c37a0$650fa8c0@xxxxxxxxxxx

Dear Wayne:

Due to the limits of what you can update and what macro's can do, there isn't anyway to have a macro ask a question and then take action based on that answer unless those buttons are on the form, and even then getting the values after the question has been asked is a little tricky.

I can give you VBA code examples where that can be done within VBA code without to much programming?

If you would like me to post that, I would be more than happy to work it out for you and post the code of how it can be done in VBA.

Most of it is under 15 lines of VBA code and a lot easier to read as well.

Joe P.



-----Original Message-----
From: Wayne Veale [mailto:venterp@xxxxxxxxxxxxxxx]
Posted At: Wednesday, May 17, 2006 7:33 PM
Posted To: microsoft.public.access.macros
Conversation: CHECK FIELD FOR PRINTING
Subject: CHECK FIELD FOR PRINTING

I have a field on a tbl I update witha update query. I want to check that
field, that record, for >= 50.00. If it is, I want to show a form asking if
usr wants to print a report (coupon) or not. If yes, I want to subtract
50.00 from the fld and print the rpt, if not, end. I tried using qry and
macro but can't get it. (I'm still a newbe)
Thanks WWV


Relevant Pages

  • Re: CHECK FIELD FOR PRINTING
    ... Please make sure in your reference Library to install the Microsoft DAO ... DoCmd.OpenReport "Coupon", ... Conversation: CHECK FIELD FOR PRINTING ... I can give you VBA code examples where that can be done within VBA code ...
    (microsoft.public.access.macros)
  • Re: CHECK FIELD FOR PRINTING
    ... I can give you VBA code examples where that can be done within VBA code ... Conversation: CHECK FIELD FOR PRINTING ... I want to show a form asking ... macro but can't get it. ...
    (microsoft.public.access.macros)
  • Re: FAX from VBA
    ... If have a fax modem installed then printing to WinFax is one way. ... How do I FAX with VBA code? ... I researched the newsgroups and I believe that I have to have some ...
    (microsoft.public.excel.programming)
  • Execute code after printing with the BeforePrint event
    ... I tried using cancel = True, but it prevents printing from the VBA ... the is still some VBA code to execute after ...
    (microsoft.public.excel.programming)
  • Re: DOS Newline Character
    ... the ECMA and ISO standards and my old ASR33 teletypewriter would ... > carriage returns and line feeds, a 0x0d causes printing to resume at the ... (I think the reference doesn't tell the full story WRT the DIP ... Printing on GNU/Linux? ...
    (comp.os.linux.misc)