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 Replies
ADVERTISEMENT
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
Jan 29, 2008
I have a number of fields that hold values (scores - either 0,1 or 2) that need to be summed but in some cases the value is 99 (which is recognised by our stats program as a N/A type of anwer- This occurs when a question is optional and the user hasnt answered it. I did not want to value to be null (since its not like the user didnt answer it because they missed out on it by accident but rather they could not) and it couldnt be 0 either since 0 actually means something different in the context of the questionnaire.Lets say I have Q1 which has a value of 0, Q2 has a value of 1, Q3 has a value of 99 and Q4 has a value of 2I want to get the total of Q1+Q2+Q3+Q4 for a particular entry but if the value of any or all of the questions are 99 I want access to ignore it and just sum the rest of the values i.e. the sum should read 0+1+2+(99)=3 not 102I want to be able to include this sum function in the expression builder if possible since I am using it for a report. Can someone please help?
View 3 Replies
View Related
Jan 16, 2006
I have a Text box on a Form that copies data entered into other Text boxes on the same form.
I have used the formula =[Text2] &" "& [Combo26] etc in the main text box that I want all the information in.
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.
View 1 Replies
View Related
May 6, 2014
I want to combine six different memo fields into one. I found this code and it works to combine two fields so I edited to add a third and it does not do anything.
Code:
Comments: [QAComments1] & IIf(IsNull([QAComments2]),"","; " & [QAComments2])
This is my edited code to add a third field:
Code:
Comments: [QAComments1] & IIf(IsNull([QAComments2]),"","; " & [QAComments2] & IIf(IsNull([QAComments3]),"","; " & [QAComments3]))
What am I missing to add the other fields?
View 3 Replies
View Related
Jun 11, 2006
G'day,
I want to produce some UPCa bar codes which require 11 digits of TEXT for the barcode function to work.
I want the bar code to be made up of several fields
Make 3 Chars (Text) (eg 021)
Model 3 Chars (Text) (eg 103)
Serial_Number 5 Characters (Numeric) (eg 00025)
(I need to keep the Serial_Number field numeric so that it increments in modulo 10 format (ie get Numeric only results))
So i need to produce a field that looks like this 02110300025 after the 3 fields are concatenated
However I am getting 02110325
I'm sure that the answer is simple but I seem to be having a mental block. Does anyone have any ideas? Your help will be very appreciated.
View 5 Replies
View Related
Apr 18, 2014
I've created a report which shows zeros in various columns where there aren't any values to report. I think the report would look better and be easier to read without these zeros. I would like to suppress them and display blanks instead. I'm not sure how to do this.
View 1 Replies
View Related
Dec 31, 2004
Hi all,
Ive got a table called tblClientCar, this is its structure:
ClientCarID
ClientID
CarID
I want to use an append query to concatenate ClientID and CarID together and putting the concatenated value into ClientCarID. How would i do this?
Ive tried using a form a two combos so when i select the clientID from the 1st combo and then the CarID from the 2nd combo, then run the append query to write the concatenated value into ClientCarID of the table. But it says writing 0 rows to table and the ClientCarID isnt concatenated when i check the table. This is the query sql syntax i was using:
INSERT INTO tblClientCar ( ClientCarID, ClientID, CarID )
SELECT tblClientCar.ClientCarID, tblClientCar.ClientID, tblClientCar.CarID
FROM tblClientCar
WHERE (((tblClientCar.ClientCarID)=[Forms]![frmClientCar].[Combo6] & "" & [Forms]![frmClientCar].[Combo8]));
I also tried another way. The 2 combos add the selected values into ClientID and CarID in the table tblCar. So i made the append query slightly different to concatenate ClientID and CarID to form ClientCarID. This is my query sql syntax:
INSERT INTO tblClientCar ( ClientCarID, ClientID, CarID )
SELECT tblClientCar.ClientCarID, tblClientCar.ClientID, tblClientCar.CarID
FROM tblClientCar
WHERE (((tblClientCar.ClientCarID)=[ClientID] & "" & [CarID]));
I get the same result as the 1st query. What am i doing wrong?
Is there another way of doing what im trying to do? Whats the correct sql syntax for doing this?
Thanks
Jim
View 8 Replies
View Related
Jul 13, 2005
We use two different systems in our office that have notebook facilities. One of them stores only a limited number of characters in the note field per record and as such, some notes actually span several records.
The other system stores the whole note in one record.
We want to transfer all the notes from the first system (1 note over several records) to the second system (1 whole note in 1 record).
I have a table with the notes from the first sytem which looks something like
Note1 - Line1 - Text
Note1 - Line2 - Text
Note2 - Line1 - Text
Note3 - Line1 - Text
Note3 - Line2 - Text
Note3 - Line3 - Text
What I want to do is, for each note, combine the separate lines into one record.
I have been able to do this in Excel with some formulas (see attachment) but am wondering if it is possible to do this in an Access Query (i.e. GroupBy the note number and have a calculated field combining the individual lines of the note, or something similar)?
View 8 Replies
View Related
Sep 20, 2006
I have a query that is set up to join two name fields...for example:
[ELIGVENDORS.LSTNAM] & [ELIGVENDORS.FSTNAM]
The issue is that this is perfect for names that are entered in the table like this:
Lstnam: ABC HOSP Fstnam: ITAL
They are entered like that for groups, but when individual doctors are entered, the data entry folks are entering them like this:
Lstnam: SMITH Fstnam: BOB Titlcd: MD
So when I join them the first displays correctly as ABC HOSPITAL, the second displays as SMITHBOBMD and I have to manually go in and add a comma.
Is there a way to do an if/then statement or something to tell the query to display results If the titlecd is NOT NULL, display as [ELIGVENDORS.FSTNAM] & [ELIGVENDORS.LSTNAM]&", "&[ELIGVENDORS.TITLCD], else display as [ELIGVENDORS.LSTNAM] & [ELIGVENDORS.FSTNAM]
I'm sure there is, I am new to IF/THEN statments though and was hoping to get some help setting it up.
Thanks in advance and I hope my description is clear enough.
Han
View 2 Replies
View Related
Apr 1, 2015
I have five reason fields in my table and I would like combine them into one field on my report, with line breaks between so each reason starts on it's on line. Also if there is a blank record, I would like the report not to display a blank line. I have found ways to do this online for 2 records but I need this for 5.
Also when I do manage to get the lines all to show in the report there are 3 paragraph returns between them - making the reason display of the report 15 lines tall, not just 5. The code I have so far, which displays each of the reasons but spaced as described is:
=[REASON1] & " " & [REASON2] & " " & [REASON3] & " " & [REASON4] & " " & [REASON5]
View 5 Replies
View Related
Jun 28, 2005
Hi
I did a search to no avail...
I am trying to concatenate Address fields into one text box. The Control Source pull-down menu gives me the Field Names listed as QueryName.ColumnName.
I know that if they listed the fields as just ColumnName, you'd simply go:
ColumnName & " " & ColumnName2...
But the way these columns are defined, I cant find the correct syntax.
Is there a way to do this without changing all my queries??
Thanks again! :)
Mike
View 8 Replies
View Related
Jan 29, 2007
I have a table with three columns
Column A, Column B, Column C
in these 3 columns i have different values and in two fo these columns there are blanks. I want to search for this blanks and fill them in with a static value. But only the two columns.
How can i do this? Update Queries?
Thanks you
View 5 Replies
View Related
Jun 8, 2007
New problem each day! Ha. Ok I have a crosstab query with data in monthly columns for various accounts. For some accounts there is data in jan and march but not feb. Is there a way to get these blanks to be 0 without manually adding them? Thank you!!
View 2 Replies
View Related
Apr 24, 2008
i am in a query and trying to use criteria box to get rid of any record that has a blank in the ItemDescrption column.
i have tried Not Like " *"
Not Like "*"
Not Like " "
with no success.
Thanks
View 5 Replies
View Related
Jul 27, 2006
Hi all,
I have been trying to create a database that looks after staff holidays.
Here's how it looks at present
TBL_Holidays:
Staff_Index
Staff_Name (From a lookup)
Start_Date
Number_of_days
TBL_Holidays_Booked:
Staff_Name
Dates_Booked
Once the form (FRM_Holidays) is filled out I had (until I gave up and decided to ask for help - 2 weeks) a button that went off and run a append query.
Here's my problem. Once the button is pressed I need the TBL_Holidays_Booked to fill with the Dates_Booked.
ie.
John Smith wants his holiday to start on the 1st August for 10 days.
The resulting TBL_Holidays_Booked would look like the following:
John Smith 01/08/06
John Smith 02/08/06
John Smith 03/08/06
..
John Smith 10/08/06
Is there a way to do this? or is there a simplier way of doing it?
Regards
Mark
View 3 Replies
View Related
Oct 11, 2005
Hello
I have a back-end database which imports a spreadsheet which is automated. Every-time the spreadsheet is imported a large amount of blanks appear above the information i require.
Is there away i can automatically stop this from happening?
HELP?
View 2 Replies
View Related
Dec 13, 2012
creating mailing labels starting with an Excel Workbook imported into Access. When I get to the point of previewing the labels, there seem to be maybe 10 blank labels. I don't have a clue how this could happen but I obviously don't want to waste the ten or so labels (out of about 90 total). setting the print area and removing empty Worksheets, but nothing works.
View 4 Replies
View Related
Nov 8, 2006
I have co-workers cutting and pasting names into the database name field and some of them are having an empty space in front of the name. Is there a way to get rid of the space or add a valadation for this? What is wrong with these people, this is just laziness at its best!
When a search for names is brought up, they are not shown due to the space so they are not in A - Z order...
View 3 Replies
View Related
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
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
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
Aug 16, 2014
I have five address fields:
add_1
add_2
add_3
city
county
zipcode
What I want to achieve on my (Word) letters, forms, reports etc is a concatenated list that does not have any blanks!!
city, county and zipcode will always be filled however it is possible that add_2 and add_3 could be blank. I hope I am explaining this correctly?
How do I achieve this? I envisage a query which produces just one list that I can just add to my documents but I am struggling with the formula to ignore the blanks.
View 5 Replies
View Related
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
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
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 8 Replies
View Related