Solved

Test for BOF in a recordset

Posted on 2004-03-20
2
228 Views
Last Modified: 2006-11-17
Here is the SQL statement I currently have:

SELECT tblEqpt.EqptID, NZ([Amount],"0") AS CalcAmount, NZ([COAmount],"0") AS CalcCOAmount, NZ([InvoiceAmount],"0") AS CalcInvoiceAmount, (NZ([Amount])+NZ([COAmount])-NZ([InvoiceAmount])) AS [Amount Remaining]
FROM tblReq INNER JOIN ((tblEqpt INNER JOIN tblChangeOrder ON tblEqpt.EqptID = tblChangeOrder.EqptID) INNER JOIN tblInvoice ON tblEqpt.EqptID = tblInvoice.EqptID) ON tblReq.ReqID = tblEqpt.ReqID
WHERE (((tblEqpt.EqptID)=[Forms]![frmRequisition]![txtLink]));

2 possibilities will exist
1. tblChangeOrder may not have any rows
2. tblInvoice may not have any rows

If this is the case, I need the calculation to be performed just as if [COAmount] were 0 and [InvoiceAmount] were 0.

I thank you in advance for your assistance.
0
Comment
Question by:CatDaddy2003
2 Comments
 
LVL 54

Accepted Solution

by:
nico5038 earned 500 total points
ID: 10641882
As described in the other question, you'll need the so-called outer-join.

Double-click the connection lines between the three tables and change the option into 2 or 3 making tblEqpt leading.

Nic;o)
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 10641902
Save your query as Query1

Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim rs As Recordset
    Set db = CurrentDB()
    Set rst = db.OpenRecordset("Query1", dbOpenDynaset)
     
  If rst.BOF = True Then  'No records

 'your codes for calculation

    End If
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now