A third-party application I use exports data with 3 header rows. I usually have to go into Excel and concatenate the rows into a single header row, then export the file to Access to apply queries. I want to minimize the steps in this process, so I'm wondering if it's possible to do this concatenation in Access (with or without VBA).
I use following function to concatenate data from multiple rows into a single row/field. It puts a comma ',' after each concatenate. What I would like it to do more is to put 'and' instead of comma between the last two concatenated words. For example: Now it gives me Value 1 but I want to get Value 2.
Value 1: FormRegNo CombinedParticipants DC-190 Political parties, CSOs, community residents
Value 2: FormRegNo CombinedParticipants DC-190 Political parties, CSOs and community residents
Function: Option Compare Database Option Explicit Public Function ConcatField(strSQL As String) As String Dim dbs As Database Dim rst As DAO.Recordset Dim strConcat As String
To anyone who can help, I have created a function that loops through an amount of records and concatenates them into a single comma-separated string. What I would like to do is concatente the values into a list. Instead of:
value1, value2, value3
I would like to see
value1 value2 value3
This needs to be in a single record only. The code I am using is: ---------------------------- while not rec.eof string = string & ", " rec.movenext wend string=left(string,len(string)-2) --------------------------------
Thanks for all your help. I have tried to insert char(20), but this only seems to work in Excel. Access gives me invalid char symbol.
I am trying to concatenate multiple rows into one record. I googled it and found many functions in VBA that do the job. However my problem is that my query will be linked directly to Excel file and then I get an error message saying that Excel could not recognise this function. I could potentially insert data into new table and link that table to Excel but I need to avoid end-user exposure to Access as much as possible.
So I am desperately trying to find a way of doing this without VBA code.
Example of data:
Customer Name |Order Number Smith |O101 Brown |O102 Smith |O103 Green |O104 Brown |O105
I am trying to achieve below:
Customer Name |Order Number Smith |O101, O103 Brown |O102, O105 Green |O104
Is there any way I can use data in the row as a column header ? I only have 1 row of data which i want to use as a header to I can link it to other tables/queries.
I have about 36 names and each of those names appears anywhere from 2 7 times each. Each name entry has a comment1 and a comment2.What I would like to do is create a form that allows me to choosea name and the display the comments 1 and comments 2 in text boxes.
I have made the form to allow me to choose a name and it shows one of the comment1 and one of teh comment2 in the adjacent text boxes as planned but, I want all the comment1s for Bob to show in the text box for comment1 and all of the comment2s for Bob to show in the Comment2 text box.I believe I need to concatenate the results in the comment1 and comment2 boxes, but I do not know where or how I would do that.
I want create a query that adds a field called DATE to my existing data. I want every record to have a date of 1/1/2011 populated in it. I need it to have date formatting so that I can add/subtract other dates from it.
I'm building a simple access database to be used in a factory. It's pretty much there now, in the sense that it does all it needs to do, but some things feel a little "clunky". One of these things is the page where new products are created.
When a product is created the user has to specify what raw materials it's made up of and that works great, there is a continuous sub form that lets the user just add a row for every raw material. Having it as a continuous form makes sense as there can be lots of rows or just a few, so it's flexible.
Currently though the labour/time on that page works in the same way. But it feels a bit silly as there are only 3 sorts of labour (at least currently, they might add a couple more later). The labour types are..
- Build - Finishing - Handling
My question is, how would I go about turning the existing continuous row-by-row subform for labour into a single form that just listed those three types of labour (read from my labour type table)? So that it just shows a row that asks for quantity of each available labour type.
Not all products have all types of labour but it would be fine to write a 0 in the labour table for (for example) Finishing against a product that for example didn't need Finishing Labour. Obviously with the current continuous form approach no row would be written for Finishing if the user didn't select that.
I guess I could hardcode a single form to show the three current types, but ideally it would be flexible, coping with new labour types when the users find they need to add them.
For each record in my database, there are observation periods which are recorded in the format dd/mm/yyyy hh:mm:ss, titles as follows
1st Obs Start 1st Obs End 2nd Obs Start 2nd Obs End 3rd Obs Start 3rd Obs End.
I have been asked to create a query that will quickly show how many obervation periods commenced in a particular month. What I am trying to do is create a column that will be named Obs Start, and another, Obs End. For each record ID, this would then show as follows:
I am trying to create a form with a button attached to each record that would allow the user to click the button and it would automatically open outlook and fill in the TO:, SUBJECT: and BODY: fields. Here is the code that I currently have:
Code: Private Sub Command33_Click() Dim strEmail As String Dim strMsg As String Dim oLook As Object Dim oMail As Object Set oLook = CreateObject("Outlook.Application") Set oMail = oLook.CreateItem(0)
[code]...
There are two issues I keep running into:
1. This code opens outlook and populates all of the fields but pastes the email incorrectly. Instead of pasting just the email (email@email.com) it pastes the html tags as well (email@email.com#mailto:email@email.com#) which means that the user would have to delete everything between the #'s in order to send the email every time.
2. I currently have the email BODY pulling from a table but this obviously limits what I can do. I would like to simply encode the BODY within the VBA code. The setup I am looking for is: one paragraph a blank line a hyperlink to a website a blank line another paragraph
Hi, thanks in advance for any help you can offer. I've got a table that has
Date Time Tag ID Power Level
throughout the day a computer listens to several tags (transmitters) and records the power level of the signal generated by the tag each 3 seconds. What I'd like to do is build a query that gives the Date, Time and Maximum Power level reading for each tag ID. I only want 1 record per tag per day
I've tried using "group by" and max in the query but this gives me all the times throughout the day.
Not sure if what I want to do is possible, or at least possible the way things are set up.
I have a massive table - c. 6 million rows. It contains data along these lines:
Plan#, Item, Price, Description, Colour, Value, Location, etc.
The primary key would be Plan# + Item. Each Plan# has approximately 1,000 Items, and there is only 1 Item per Plan#. There are only a limited number of Items (c. 1500) and all or only some Items might be assigned to the Plan#. All items under each unique ID# belong together, sort of in a set. So this huge table has approx. 6,000 unique sets (based on Plan#).
To add to the confusion, Item A under Plan#1 may have different information (Price, Description, Colour, etc.) from Item A under Plan#2. I know this isn't a great way to set up data but this is what I have to work with.
Over the years it's possible that the exact same combination of Items with identical values might have been set up for multiple Plan#s. What I need to do is find any Plan#s which have the exact same combination of Item, Price, Description, etc. So if Plan#R has 200 rows and Plan#S has 201 rows, it automatically doesn't match. If Plan#R has 200 rows and so does Plan#T, all information in each record must match between the two Plan#s (with the exception obviously of Plan#).
I don't think this is possible, and if it is I am sure it's not going to be easy. So far the best I can do is to come up with finding duplicates on Item, Price, Description, etc. but that's only one record at a time and doesn't tell me if the two Plan#s match.
Any help or suggestions would be much appreciated.
I have a problem I am working and and am not sure what the best approach is, hoping someone can lend me some insight:I have two fields on a table:SerialNumber....LocationI need to concatenate these two (no problem there). However my situation is such that my serial numbers vary in the number of digits. For example:serial - 55124 (five digits)serial - 552356 (six digits)serial - 5514235625 (ten digits)the serial number field is 10 characters and the serial numbers can be anywhere from one to ten in length (this is external data I am working with, not data I created)When I concatenate the two fields I need the location value to always be in the same place, so if I have a location called - TEST - I need the end result of my concatenate query to place the location always after the tenth place of the serial number position, like this:55124_____TEST552356____TEST5514235625TEST(Without the underscores)Don't ask me why...it's a long story.
I have a table that I would like to concatenate three name fields:
Last Name, First Name, Middle Name. I inserted a field between each one to create a space when the fields are brought together. The table looks like this:
Last Name, Blank 1, First Name, Blank 2, Middle Name
When these five fields are brought together they can not exceed 25 characters, so the middle name will cut off when the field reaches 25.
I have a table with two fields that I am wanting to concatenate. The two fields are: Order and Line#. The line numbers are sequential by tens, like this: 10, 20, 30...etc.
So I have order lines that are from two to four digits. Like this: 20 120 1020
All order numbers are six digits. I want to concatenate the order and line (easy to do) my problem is I want to append zeros in front of any line number less than four digits. For example, using the lines above and an order number of 111111 I want the result of the concatenation to be like this: 1111110020 1111110120 1111111020
My database has FirstName and LastName fields. I would like to initialize a new field called UserID with the first letter of the first name concatenated to the last name. I have found references that point to using Left([FirstName],1)&[LastName] but am unsure if this can be done in the table definition or if it must be done using a query. Either way I could use some advise on initializing this fields since I have 3500 registered users. Thanks
Here’s my goal. 1.)I have one column and want to add a 633 in front of if. a.Expr3: "633 " & [Grp] & "" b.This only shows 633 and asks for an entry for the GRP? Why? I want the format to be 633 xxx. If I do add, lets say, 123 in the popup, all of the columns are 633 123. 2.)After combining the following, I want to take that number, and look it up in another query. If the number matches a number in the other query, than I want it to enter the number in column 1. If not, I want it write no number. I have gotten this part to work using an IIF function but I just wanted to let you know what I am after.
I have this query SELECT [9A].DO, [9A].WORK, [BATCH] & " " & [SOURCE] & " " & [NO] & " " & [SEQ] AS RECEIPT, FROM 9A;
It returnes the results like this: RECEIPT 6/2/2003 P 29 10 1/15/2003 P 54 55 3/3/2003 P 42 7 1/6/2003 P 39 35 12/30/2002 P 23 30
What changes are needed to the query to return it like this: 06022003P0029010 01152003P0054055 03032003P0042007 01062003P0039035 12302002P0023030
In other words The date must have 8 charactors with no / Then P with no spaces before or after The next number must have 4 charactors no spaces and the last number must have 3 charactors