Query Ignoring 'zero' Catch Sets

Jan 6, 2006

I have a db with two tables linked by a Set_ID field. One table characterizes set information (date, time, location etc) and the other table has records for groups of fish caught in the set. The fish_table has (amongt others) a field for species (text), clip-status (yes/no), coded wire tag status (yes/no), and 'count' (number). The count field is necessary to allow input of groups of fish en-masse, or individually, depending on the amount of accessory information obtained.

Obviously, some sets catch no fish and so no record is entered into the fish table for those sets.

When I design a query, I want to produce a table that sums up the count field for each set, and produces subtotals for each species (and for the 4 variations of the clip/tag status fields).

My efforts so far are only partially succesful in that I can produce the correct subtotals, but only for sets where something was caught. Sets with no corresponding fish_table record are ignored instead of treated as zeroes.

Is it necessary to manually enter a 'zero' count for each species of interest for each set that we do? (Massively time consuming) Or is there some other way to query the db that forces the query to equate no fish record with a zero value?

Any thoughts? I've searched the forum, and googled, but haven't come across anything I could recognise as analogous to my dilema.

View Replies


ADVERTISEMENT

Ignoring Null Values From Form In Query

Mar 21, 2006

I have a form with 4 different search fields used to query a table and limit results: Policy#, SSN, Credit_Amt, Debit_Amt. Any matching rows based on the search criteria are returned in a subform.

My problem is how to handle any fields where the user doesn't specify a search value.

In my query, I have the Criteria set to:
Field: Policy_No
Criteria: =[Forms]![form name]![Policy#]

Field: SSN
Criteria: =[Forms]![form name]![SSN]

and so on....

If I place my criteria on different OR lines, the query runs, but if a user specifies more than 1 criteria, I get all the data for one criteria(such as policy# matches) and all the data for the second criteria(such as all the records for a certain credit_amt, regardless of Policy #).

If I place my criteria on the same criteria line, effectively making it AND, I get no results because I assume the database is looking for any blank search field values.

So, how do I make the query an "AND" query, but actually get results by ignoring any NULL search fields? So if a user enters a Policy# and Credit_Amt, the results will be only matching rows by Policy# AND Credit_Amt, and doesn't look at SSN and Debit_Amt.

I've tried different iterations using IIF(Not IsNull(.... to no avail.

Thanks!

View 3 Replies View Related

Ignoring Leading Zeros In Join Query

Jul 9, 2007

Hi everyone,

I have 2 linked tables from 2 different databases, there is a common field in both: “CORP_NBR” I need this field in order to create a join, but the problem is that in one table this field stores leading zeros and in the other table it doesn’t. I can see in design view that this field is text type in both tables. I cannot change field types because I don’t own the objects.

Is there a way or a function that I can add in my join query to ignore leading zeros? :confused:

I appreciate your help

View 6 Replies View Related

Catch A Parameter Value

Oct 25, 2005

Hi!
When I run a querry I have a parametr querry like this:
Between[FirstDate] and [LastDate]

I want to "catch" the FirstDate and LastDate from the parameter querry and place them in the head of the Report based on the same querry.
How do I do this????

View 1 Replies View Related

Want To Catch An Optionbuttons Value

Feb 21, 2006

Hi!
I have a db in Access 2003.
I have a form named frmStat with FirstDate and LastDate and five options
I want to use the values in a querry.
I can catch the Datevalue with [Forms]![frmStat]![FirstDate] and so on but how do I do to catch the value from the options button?

Jack

View 5 Replies View Related

Limiting Records Retrieved To 10... With A Catch.

Jul 12, 2007

Hello all,

I am a buyer and I'm attempting to create a query in Access 2003 that will list all of my vendors (20 in total) and their top 10 selling sku's. Here are the fields I am using:

Buyer_Code
Supplier_Number
name
Sku_Global
OEM_Number
Part_Description_English
Status
C_Last12_SLS_QTY

I have created one Query including all of the above fields as well as the following field, "XP1: GetTen([Supplier_Number])"
In this query I have set "Supplier_Number" to sort ascending and "C_Last12_SLS_QTY" to sort descending.

I then created a module, written as follows:

Option Compare Database
Option Explicit
Public wSUPPLIER_NUMBER As String
Public wNum As Integer

Function GetTen(SUPPLIER_NUMBER) As Long
If wSUPPLIER_NUMBER = SUPPLIER_NUMBER Then
wNum = wNum + 1
Else
wNum = 1
End If
If wNum > 10 Then
GetTen = 0
Else
GetTen = wNum
End If
wSUPPLIER_NUMBER = SUPPLIER_NUMBER
End Function

I then created a second query with all of the above fields, and the criteria for the XP1 field as ">0"

As far as I can tell, this should bring me back a list with the first 10 rows for each of my Supplier numbers... unfortunately it is for some and for others it's bringing back more than 10 rows. The other problem is that it seems to be picking random rows to bring back, and not just the first 10 (which because in query1 I set the C_LAST12_SLS_QTY field to sort descending, should be my top 10 selling sku's).

Does anyone have any idea as to what I've done wrong? I'm pretty new with Access so I may be missing something pretty simple.

Any help would be greatly appreciated.

Antonio

View 3 Replies View Related

Catch A Null Primary Key Error

Jul 21, 2006

Hey guys,

Anyone know how to go about catching the "Index or primary key cannot contain a Null value." message box and perhaps showing a custom message instead?

Thanks in advance,
Bob

View 2 Replies View Related

Sub Reports With No Data - How Do I Catch And Prevent Errors In Calculations

Jun 15, 2004

I have come across this problem several times. I have sub reports on a report and calculations are done using the data in the sub report. In many instances the subreport is empty. The calculated fields read #error. (otherwise the report runs well and records with data calculate fine) I would like to hide these errors and associated labels when the subreport is empty. Everything I have tried either does nothing (error still appears in text box - but runs ok otherwise) or I get a runtime error since it is trying to access "nothing" in the sub report.
How can I catch and therefore react on this empty sub report. (or subform too)
Thanks
Lisa

View 13 Replies View Related

Replica Sets

Feb 4, 2008

Hi

Am using a replica set in order to distribute a school reporting system around teaching staff.

Everything works fine apart from one thing. A marking system (basically 1 to 6 list) is stored in a linked table. Before replication this appears in the correct order. Once the database has been replicated however the list is placed in a random order and I cannot rectify this.

With only 6 items this is not much of a problem but I also want to use a much longer list and the same problem appears.

Can anyone explain why this happens and if there is a simple way to get around it?

Am really only an Access novice and I really appreciate any help that you could give me.

Cheers

Mike

View 9 Replies View Related

Working With Large Data Sets.

Mar 31, 2008

Hi guys,

I have a query that returns a large data set (~100k rows/month).

I am currently inefficiently exporting week-by-week to Excel to carry out some manipulation (mainly a set of "if" statements to calculate differences between records that have the same site id).

Is there a way to write a function in Access to carry out the calculations? I'm not too familiar with Access VBA apart from coding functions for forms etc.

View 12 Replies View Related

Modules & VBA :: Run Two Sets Of Code On (Before Update)

Aug 30, 2013

I have a set of code to keep an audit trail that calls a module:

Code:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Call AuditTrail(Me, CurrentCYIDPK)
End Sub

Calls

Code:

Option Compare Database

Const cDQ As String = """"
Sub AuditTrail(frm As Form, recordid As Control)
'Track changes to data.
'recordid identifies the pk field's corresponding
'control in frm, in order to id record.
Dim ctl As Control
Dim varBefore As Variant

[code]....

how to run both of these events on Form_BeforeUpdate.

View 11 Replies View Related

Forms :: Using One Form But Have Different Record Sets?

Mar 18, 2013

I have multiple forms that do just about the same thing. I want to clean up the database so I am going to use one form and switches to vary the data or displays if needed. the form can be opened directly, linked to a button and used as a subform. the form is based off one table, but depending on how its opened, the criteria for which record is shown changes. when used in the subform it needs to be based of a field in the main form. When used on the form with the button that opens the form it is using data from the button.

I have 2 different qry's for each problem. I just can't get the form to pick the correct qry va VBA code. I want to have the forms switch to determine which qry to use.

View 4 Replies View Related

Duplicate Sets Of Records On Condition?

Dec 8, 2012

I have a quotation database running in our company network which we use to send quotes to customers. A quote may have one or more items in it and each item has different prices based on the quantity. Each item will have a record in the database. So, if a quote has five items, there will be five records with same quote number and if 30 items, 30 records with same quote number.

Many times, same enquiries are coming from different sources (customers) asking quotes specially Govt orders. Now we need to take every enquiry as separate and feed separately in the database. Consider the time for a quote which has 30 items in it and each items has 6 level of pricing. When this same enquiry is coming from 12 different customers, it takes a lot of time to feed it in.

Now my question: How can I copy all the records belongs to one "quote no" and add it to the same table with a different quote number and some changes to the other customer related fields? If I can do that, I just need to change the customer address and I am ready with the second, then third and so on. I want to copy all related records, change quote number and related fields and then append to database.

Also I need this when I revise a quote. The system needs to keep the old quote as well as the revised quote for future reference. If I can duplicate it in one command, I just need to do the changes, Revision Number, Revision Date etc. and the revision is ready to go. Now I use update querries to do changes to all related records during revision. Then I will have only the revised quote in my database and when I want to refer the old quote, I have to refer the hard copy.

I know there is a "Duplicate Record" command available in form level (through wizard), but that duplicates only one record, not a selection of records as I need it here. If this can do with macros, fine. I am not an expert in VB, but if I get the code, I will attach it to a command button and use.

View 1 Replies View Related

Sorting By Ignoring × And +

Jan 27, 2007

I have a table of plant names such as

×Mahoberberis
+Crataegomespilus
Iris
Scilla
Hebe
Geranium
Acorus

Note that the multiplication and plus signs are part of the names.

If I sort the table (A-Z) I get

+Crataegomespilus
×Mahoberberis
Acorus
Geranium
Hebe
Iris
Scilla

What I would like to see is

Acorus
+Crataegomespilus
Geranium
Hebe
Iris
×Mahoberberis
Scilla

I am not a programmer so need to be led by the hand, but can anyone see a way of achieving this which I could copy? My simple mind tells me that I have somehow to suppress the × and + during the sort. But how?

View 3 Replies View Related

General :: Create Duplicate Sets Of Data

Aug 1, 2013

I have the following tables in my Access database.

A < B < C < D

(The "<" represents a one to many relationship.)A given row in table A can have up to 4 children (stages) in table B (stages 1 to 4).The other one to many relationships do not have any limitations as far as the number of children are concerned.All tables have AutoNumber primary keys.When the user clicks a button in a form, I want to:

Copy all data in the current stage (current row) in table B (corresponding to a given parent row in table A), to the next stage in table B.All data in child tables must be included in the copy process.In other words, for a given row in table A, by use of buttons in the forms for each of the stages 1 3, the user shall be able to do the following:

all data for stage 1 are copied to stage 2 (for user modification), then
all data for stage 2 are copied to stage 3 (for user modification), then
all data for stage 3 are copied to stage 4

Is it possible to do this in Access 2010?

View 4 Replies View Related

Modules & VBA :: Comparing 2 Record Sets And Update Them

Feb 12, 2014

i have 2 recordset and i need to compare the two. If a record doesnt existing i need it to be added I have VBA that works but it seems very slow. Is there a better way of doing it

Dim rs As DAO.Recordset
Dim rs2 As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT * FROM ExorData")
Set rs2 = CurrentDb.OpenRecordset("SELECT * FROM MainForm")
Dim TJb_Main, TJb_new
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst

[Code]..

View 14 Replies View Related

Ignoring International Characters

Nov 7, 2005

When running a search I would like Access to ignore international characters like á é í ó ú ñ.

For example searching for "Amelia" matches both "Amelia" and "Amélia"

I know this is done in SQL Server by setting it to ignore nonspacing characters.

Can this be done in MS Access?

View 1 Replies View Related

'Sum' Ignoring Minus Figures

Jan 22, 2007

I've been using the following query:

SELECT
[qry_1].Month,
B_Division_Group.Grouping_Name,
Sum([qry_1].Month_Client_Count_from_B) AS Monthly_Count,
Sum([qry_1].Month_Assets_from_B) AS Monthly_Total,
Sum([qry_1].YTD_Client_Count_from_B) AS Yearly_Count,
Sum([qry_1].YTD_Assets_from_B) AS Yearly_Total
FROM
([qry_1] INNER JOIN tbl_branch
ON [qry_1].BranchCode = tbl_branch.BranchID)
INNER JOIN B_Division_Group
ON tbl_branch.BranchName = BDivision_Group.N_Br
GROUP BY
[qry_1].Month,
B_Division_Group.Grouping_Name;

While all monthly and yearly values were positive, the query produced exactly the results expected (i.e. one row of data for each Grouping Name/Month combination, containing the overall totals for each field).

Now, however, some Grouping Names have minus values and the query is showing an extra row (one for positive values, one for negative). It's as if having one or more minus values is being treated as a new Grouping Name/Month combination.

Is Sum() the correct method to use, when dealing with negative values, or should I be using some other function?

View 3 Replies View Related

Ignoring Blank Fields

Jan 15, 2006

:confused: I have a Text box on a Form that copies data entered into other Text boxes on the same form.
Sometimes there may be the odd text box that does not have any data in it.
Is there anyway that I can put in code so that the blank text boxes are not copied into the main text box i.e. Only the populated text boxes are to be copied.
Thankyou for any assistance that you can provide.:eek:

View 4 Replies View Related

Table Setup For Survey DB Using Multiple Sets Of Questions

Sep 19, 2005

Good morning,

I am having problems figuring out how to set up my table/query structure for a series of surveys that are based on specific user groups. In a nutshell how do I set up the relationships for the Questions, Employees, and Answers if I have the following tables (simplified):

tblQuestions
--------------------
QuestionID (P)
UserGroupID
Question

tblEmployees
--------------------
EmployeeID (P)
Name
UserGroupID

tblAnswers
--------------------
AnswerID (P)
QuestionID
EmployeeID
Answer

The functionality requirements are:

1. Create a set of questions for two or more user groups (each set contain different questions).
2. Assign Employees to a specific user group.
3. Employees are able to enter the DB to answer the questions within their user group.

What should happen is the employee accesses their set of usergroup questions and enter the corresponding answers. Each time I try to set up the relationships however, the answer field ends up being uneditable.

Any help you can give would save what little hair I have left.

Thanks!

Bob

View 2 Replies View Related

Modules & VBA :: Combining Multiple Data Sets To 1 Table?

Aug 8, 2014

I'm trying to set up a way to import and combine excel files that contain multiple data sets. So for example, each excel file has a summary heading which consists of the first 3 rows.

Each data set thereafter consists of approximately 50-60 rows of data that I would like. There are approximately 1400 groups of data. Each group has a label which includes the state and the store number. I would like to automate a way to copy the state and store number information down each data set as well.

I have approximately 200 excel files that I want to load into access and have it format it so it basically will end up 1 big file with State, Store Number, relevant information from the data set. I've seen a module do this before, can't remember how to do it.

View 4 Replies View Related

Make Row Searches For Multiple Sets Of Characters At Same Time

Jun 18, 2015

I want to be able to make row searches for multiple sets of characters at the same time.The default setting cancels a row if I have inputed a set that is not on that row.Something that could be used in a store or by a lawyer looking for specifics.So these are what I am looking for:

Primary

1.) I want any row with any of the words I type to show on the results.

2.) I want the rows with the most matches to show up first.

Secondary

1.) Recognize sets of characters that are close to what I type to make up for spelling errors and typos, prioritize those that are closest.

2.) To be able to choose the rows I want and add them to another list quickly where the summing cost will be calculated in the last raw (multiplying the price of a row by how many the customer wants.)

View 6 Replies View Related

TransferText Import Ignoring The First Line

Sep 26, 2005

I am currently importing data using the the "TransferText" method in Visual Basic; e.g., expression.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)

Per the above description, I can either include the first line as a field name, or as data. Is there any way to simply ignore this data row and start the import from row 2 onwards?

Thanks as always

k

View 2 Replies View Related

Ignoring Rows In File Import

Mar 13, 2006

I am currently trying to import a text file into an Access (2000) Table. My text file has a header line (first record) and a footer line (last record) which I want to ignore when importing. I am sure someone out there would have had a need to do something similar to this in the past. I am wondering if someone can point me in the right direction.

I have tried a few different google searches and nothing promising seems to come back. Mostly just references to check the first line for field headings box.

Any assistance would be appreciated.

View 1 Replies View Related

Concatenating Fields Ignoring Blanks

Jun 4, 2006

In a query, I'm using concatenation to join multiple address fields (organisation, building number, street address, etc) into one field. I'm also inserting line breaks to create a formatted address and then creating a form on the query so the formatted address appears in a text box and can be copied and pasted straight into my label-writer software to print address labels.

This is the concatenation code I'm using:

Expr1: [Organisation] & Chr(13) & Chr(10) & [Building Number] & Chr(13) & Chr(10) etc.

However, one problem with which I am now presented is where a field is blank. E.g. if one of my contacts is retired, then they don't have an organisation listed in the "Organisation" field. This means that a blank line is left between their name and the rest of the address.

When running a mailmerge there is the option of skipping blank fields so that a blank line is not inserted in such cases.

How can I achieve this within the above code?

Gary

View 6 Replies View Related

Create A New Table Ignoring Dupes

Jul 18, 2006

MS Access 2000

I have 2 tables “MDW” and “LeadList”
Each table contains the same type of data (Contact information)
Some duplicate records MAY be in both tables.. (I would like to ignore the dupes).
Each table has a unique ID field but are in no way related

I need to create a 3rd table “NewTable” WHERE…
MDW!FirstName is not = to LeadList!FirstName
And
MDW!LastName is not equal to LeadList!LName
And
…….. I need to look at 10 fields

My thought was to create a query with both tables. Create Joins (where both are equal) for all 10 fields and moving on from there. The fields may or may not have values. I don't think I could add records if only of the indexed fields are null... Can I?

Does anybody see me walking in front of a freight train? Or, any other ideas?

TIA
Detrie

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved