473,800 Members | 2,332 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using a query to change a yes/no field

I have a database that is going to be used to do billing on orders. I
sent up a field for each record that is called Billed and is a yes/no
field. I want to do a query that will pull all the records that
haven't been billed, issue them an invoice, then mark the billed field
in those records to yes.

Any ideas?

Thanks in advance!
Nov 12 '05 #1
7 14759
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When you "issue" the invoices is when you'd mark each order record as
"billed." If you're doing this from a printed report you can use the
report's Detail_Print() subroutine. E.g.:

Create a report query like this:

SELECT * FROM Orders WHERE Billed = False

Create a query named "qryBillIt" like this:

PARAMETERS thisID Long;
UPDATE Orders SET Billed = True WHERE OrderID = thisID

Then set up the VBA behind the invoice report like this:

Private Sub Detail_Print(Ca ncel As Integer, PrintCount As Integer)

' Use the OrderID control on the report
' that holds the ID of the currently printing
' invoice order.
Billit Me!OrderID

End Sub

Private Sub BillIt(lngOrder ID as Long)
' Sets the Billed column in Orders to True
' for the indicated Order ID

const QRY_BILL = "qryBillIt"

dim db as dao.database
dim qd as dao.querydef
set db = currentdb
set qd = db.querydefs(qr y_bill)
qd.Parameters!t hisID = lngOrderID
qd.execute
qd.close
db.close

End Sub

One problem w/ this is some people Preview the report & don't send it
to the printer. This will cause the record to be set to Billed=True
without printing/sending the invoice! This can be solved by user
training.

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP57pqoechKq OuFEgEQL/CQCguP8NwgEsOIB RWnxOLj9e8WPSoB wAn1nK
TBmReMtxJJbUcV9 TRmevwE2y
=5KGU
-----END PGP SIGNATURE-----

Don Seckler wrote:
I have a database that is going to be used to do billing on orders. I
sent up a field for each record that is called Billed and is a yes/no
field. I want to do a query that will pull all the records that
haven't been billed, issue them an invoice, then mark the billed field
in those records to yes.

Any ideas?

Thanks in advance!


Nov 12 '05 #2
You may want to add a verify check box and have someone verify that the
invoice has been printed. Otherwise you may not notice until the invoice has
NOT been paid.

"MGFoster" <me@privacy.com > wrote in message
news:FQ******** ********@newsre ad3.news.pas.ea rthlink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When you "issue" the invoices is when you'd mark each order record as
"billed." If you're doing this from a printed report you can use the
report's Detail_Print() subroutine. E.g.:

Create a report query like this:

SELECT * FROM Orders WHERE Billed = False

Create a query named "qryBillIt" like this:

PARAMETERS thisID Long;
UPDATE Orders SET Billed = True WHERE OrderID = thisID

Then set up the VBA behind the invoice report like this:

Private Sub Detail_Print(Ca ncel As Integer, PrintCount As Integer)

' Use the OrderID control on the report
' that holds the ID of the currently printing
' invoice order.
Billit Me!OrderID

End Sub

Private Sub BillIt(lngOrder ID as Long)
' Sets the Billed column in Orders to True
' for the indicated Order ID

const QRY_BILL = "qryBillIt"

dim db as dao.database
dim qd as dao.querydef
set db = currentdb
set qd = db.querydefs(qr y_bill)
qd.Parameters!t hisID = lngOrderID
qd.execute
qd.close
db.close

End Sub

One problem w/ this is some people Preview the report & don't send it
to the printer. This will cause the record to be set to Billed=True
without printing/sending the invoice! This can be solved by user
training.

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP57pqoechKq OuFEgEQL/CQCguP8NwgEsOIB RWnxOLj9e8WPSoB wAn1nK
TBmReMtxJJbUcV9 TRmevwE2y
=5KGU
-----END PGP SIGNATURE-----

Don Seckler wrote:
I have a database that is going to be used to do billing on orders. I
sent up a field for each record that is called Billed and is a yes/no
field. I want to do a query that will pull all the records that
haven't been billed, issue them an invoice, then mark the billed field
in those records to yes.

Any ideas?

Thanks in advance!

Nov 12 '05 #3
MG please excuse my ignorance, this is my first access project.

I do understand how to set up the VBA, I have done some in my forms.
But how do I activate the VBA code? In the forms I put the references
in the event properties, I looked in the form properties and didn't
see a print event...

Create a report query like this:

SELECT * FROM Orders WHERE Billed = False

Create a query named "qryBillIt" like this:

PARAMETERS thisID Long;
UPDATE Orders SET Billed = True WHERE OrderID = thisID

Then set up the VBA behind the invoice report like this:

Private Sub Detail_Print(Ca ncel As Integer, PrintCount As Integer)

' Use the OrderID control on the report
' that holds the ID of the currently printing
' invoice order.
Billit Me!OrderID

End Sub

Private Sub BillIt(lngOrder ID as Long)
' Sets the Billed column in Orders to True
' for the indicated Order ID

const QRY_BILL = "qryBillIt"

dim db as dao.database
dim qd as dao.querydef
set db = currentdb
set qd = db.querydefs(qr y_bill)
qd.Parameters!t hisID = lngOrderID
qd.execute
qd.close
db.close

End Sub

One problem w/ this is some people Preview the report & don't send it
to the printer. This will cause the record to be set to Billed=True
without printing/sending the invoice! This can be solved by user
training.

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP57pqoechKq OuFEgEQL/CQCguP8NwgEsOIB RWnxOLj9e8WPSoB wAn1nK
TBmReMtxJJbUcV9 TRmevwE2y
=5KGU
-----END PGP SIGNATURE-----

Don Seckler wrote:
I have a database that is going to be used to do billing on orders. I
sent up a field for each record that is called Billed and is a yes/no
field. I want to do a query that will pull all the records that
haven't been billed, issue them an invoice, then mark the billed field
in those records to yes.

Any ideas?

Thanks in advance!

Nov 12 '05 #4
"paii, Ron" wrote
You may want to add a verify check
box and have someone verify that the
invoice has been printed. Otherwise
you may not notice until the invoice has
NOT been paid.


I strongly endorse this suggestion. I have seen more than a few reports come
out of heavily-used, out of adjustment departmental or office printers as
nothing but an unreadable, crumpled smudge. To manually check all those that
_did_ print successfully and uncheck the ones that did not can be tiresome
drudgery, where taking a stack of invoices and checking off the ones that
printed successfully before mailing is a simple task that can be done by
low-skill clerical personnel.

Of course, if you have printers that _never_ jam, smudge, smear, etc., it'll
be wasted effort. The closest I have seen to that are local printers
attached directly to the user's computer and that isn't usually what is used
to print a batch of invoices.

Larry Linson
Microsoft Access MVP
Nov 12 '05 #5
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The VBA is for a Report. I was assuming that you are printing a
report as the invoice. Put the VBA code in the code section of a
report.

Also, please read the other posts (warnings) on this thread - the
authors bring up good points about printing invoices.

- --
MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP6AyVoechKq OuFEgEQJXRwCfdo P38cL/zyfm3dJizVB0u7/nL8MAnja+
G1dokMi75sHsBGE 3QwWEG8tm
=5HaI
-----END PGP SIGNATURE-----

Don Seckler wrote:
MG please excuse my ignorance, this is my first access project.

I do understand how to set up the VBA, I have done some in my forms.
But how do I activate the VBA code? In the forms I put the references
in the event properties, I looked in the form properties and didn't
see a print event...
Create a report query like this:


<snip previous postings>

Nov 12 '05 #6
>
The VBA is for a Report. I was assuming that you are printing a
report as the invoice. Put the VBA code in the code section of a
report.
I meant I couldn't find where to put the vba in the report, sorry
typo.
Also, please read the other posts (warnings) on this thread - the
authors bring up good points about printing invoices.
Do you think that it's better to use a query to pop up all the records
that are being billed when the invoice(report) is printed, and give
the user the chance to mark all the records billed once they've had a
chance to check the printed invoice?

- --
MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP6AyVoechKq OuFEgEQJXRwCfdo P38cL/zyfm3dJizVB0u7/nL8MAnja+
G1dokMi75sHsBGE 3QwWEG8tm
=5HaI
-----END PGP SIGNATURE-----

Don Seckler wrote:
MG please excuse my ignorance, this is my first access project.

I do understand how to set up the VBA, I have done some in my forms.
But how do I activate the VBA code? In the forms I put the references
in the event properties, I looked in the form properties and didn't
see a print event...
Create a report query like this:


<snip previous postings>

Nov 12 '05 #7
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The VBA is put in what's known as the "code behind forms" or, more
officially, the report class module. How to get there:

1. Open the report in design view.
2. On the menu bar click: View > Code - the report's class module
will open.
3. Paste the VBA into the class module.
4. Compile & save the module.

Please note: my posted example VBA was "air code," meaning it is
untested & was meant only as an example. Your requirements may
indicate another solution.

==

I believe it is better for you to decide how you want to bill to be
mark. After all, you are the "man-on-the-scene" and will have the
best idea how your users & equipment work.

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP6FYnoechKq OuFEgEQJnDQCcCV t+npKOJUJlGap2r +jaHeYDSN4An05U
QNocxe3D7Vn+Mn+ U7mOCh3RG
=hclL
-----END PGP SIGNATURE-----

Don Seckler wrote:
The VBA is for a Report. I was assuming that you are printing a
report as the invoice. Put the VBA code in the code section of a
report.

I meant I couldn't find where to put the vba in the report, sorry
typo.

Also, please read the other posts (warnings) on this thread - the
authors bring up good points about printing invoices.

Do you think that it's better to use a query to pop up all the records
that are being billed when the invoice(report) is printed, and give
the user the chance to mark all the records billed once they've had a
chance to check the printed invoice?

- --
MGFoster:::mg f
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP6AyVoechKq OuFEgEQJXRwCfdo P38cL/zyfm3dJizVB0u7/nL8MAnja+
G1dokMi75sHsB GE3QwWEG8tm
=5HaI
-----END PGP SIGNATURE-----

Don Seckler wrote:

MG please excuse my ignorance, this is my first access project.

I do understand how to set up the VBA, I have done some in my forms.
But how do I activate the VBA code? In the forms I put the references
in the event properties, I looked in the form properties and didn't
see a print event...


Create a report query like this:


<snip previous postings>


Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2984
by: Michelle Collier-Moore | last post by:
I have a form where the user selects a client name originally from a table and then proceeds to complete other details in a sub form. The users asked to see two pieces of information relating to the client on this form, both of which are stored in the client table. As I had never done this before I found out via this group how to create a combo box called claimClientName that got its data from a query and it is bound to column 1 of that...
5
1961
by: Colleyville Alan | last post by:
I have built a SQL statement that is trying to loop through the fields of a table that was built from a spreadsheet and hence is "short and fat". So rather than hard-coding, I have a loop from field #6 to the last field (#63). When I use the fld variable (type integer) in the loop, I have no problem with this line which is near the end of the SQL statement: strMySql = strMySql & "Accts., Accts.Manager, " & "," But when I try to...
4
6039
by: Martin Lacoste | last post by:
(Access 2000) Two issues: Within a query, I need to return a field name as data (see eg. below). I need to search within 80 fields (same criteria) - is there a way to avoid 80 separate expressions (the 80 field names are stored in a table - can I get the query to look each of these up?)? Here's an example:
9
3081
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want to appear in the report is Yes, No, or Maybe. What do I need to do to change what appears in the report/what term do I need to search out in Google? Thank you Colin
3
53772
by: GL | last post by:
Hi, Is there a way to add a field to an existing table using a query of some sort (without needing to manually add a field to the table). I know how to do it with a make table query, but I have a specific need to only add a new field to a table if possible. Here's a simplified example of what I'm trying to do: I get a file with the following two fields: First Name
12
6394
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date ranges, ie between 24/09/2004 and 01/10/2004 together with 05/10/2004 and 07/10/2004 ? If I enter the "Between" criteria on different lines it returns no data.
8
3728
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: "Date","P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16","P17","P18","P19","P20","P21" 1/1/2005,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 1/2/2005,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
10
6733
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that contains only tables. I have linked the tables for the front end to the back end database. I am trying to set the recordsource of a form to a query established by the user to narrow the scope but I don't want to display the form if there are no...
10
2585
by: john | last post by:
I have a report to print envelopes. The report is based on a query. Now I need to make 10 more queries to make different selections of addresses. Every query has the same output fields as the already existing query. I know I can copy the report and base it on another query but then I would have to make 10 extra reports. How can I use just one report for all of the queries? At the moment I use the button wizard in my forms to make buttons...
21
34446
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10035
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9090
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7580
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6813
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.