Splitting Long String To Multiple Fixed-length Strings?
Sep 16, 2013
I have a table where I want to break longer strings into three-character strings.
So... for example the data item "Forest," I'd like to generate "FOR" "ORE" "RES" "EST" and write all four to another table, allowing for duplication. Alternately, we could make a list and just count the unique 3-character strings. The end goal here is to measure the frequency of 3-character strings across a set of data.
how to do this with an Access query?
View Replies
ADVERTISEMENT
Sep 29, 2011
I have a column in my table, and its size is set to 10 characters. In a form, i have a combobox based on that column, which contains the values "Corrective", "Preventive", and "Supplier". both Corrective and Preventive are 10 characters, and fill up the field to its max, however, Supplier is only 8 characters. When I look back in the table data, there are two spaces after Supplier. Basically, I can use the arrow keys to "see" the two blank character spaces. Why is that? Are these extra blank spaces taking up space they shouldn't?
View 3 Replies
View Related
Apr 23, 2008
I posted this before, but didnt get any answers
In A2007, has anyone had a problem with checking whether a text field is equal to "" in a query
ie - select * from whatever where targetfield = ""
-----------
this generated a type mismatch (I actually had <is null or ""> in the query definition, but it was the "" it didnt like.
View 1 Replies
View Related
Dec 15, 2005
I am normalizing data from a spreadsheet of just over 4000 records. The spreadsheet has a "Model" field that contains both the model number and a model description, separated by a space. I would like to split this field into two different fields: "Model_Number" and "Model_Description". The model number is one word of varying lenths.
Any ideas?
View 5 Replies
View Related
Jul 27, 2006
I hope someone can help with this one. After many years of using Access for ad-hoc data conversion this has beaten me.
I need to produce an ascii text file with fixed column widths, separated by commas, strange I know but the customer is always right. As it is fixed width I have inserted the commas by using a separate column for each one.
Numeric columns need to be left padded with zeros. I have constructed a query to do all the column selection and reformatting into a new table which I then export using a fixed length export file spec. Everything works fine except for 3 columns which are calculated by subtracting one column from another. I can get the data to look fine in the output table, the datatype is text, but when I export the table the leading zeros are stripped.
This is my expression: String(9-Len(FormatNumber([FULL_FARE_EQUIV]-[TAX_EQUIV],2,0,0,0)),"0") & FormatNumber([FULL_FARE_EQUIV]-[TAX_EQUIV],2,0,0,0).
The result in the table is exactly what I want: 000200.00 but when I export it I get a left adjusted 200.00.
I've tried using format with a "000000.00" mask which gives the same results.
I've tried removing the preceding comma column and including the comma as a prefix using the format mask ",000000.00" and also by concatenation. This looks fine in the table column ,000200.00 but I get an error when I export the table which blanks the column. Error attached.
View 1 Replies
View Related
Sep 6, 2006
I want to import a fixed length file into access 2003, it can only be imported directly into access 97/2000. This site, link http://www.ams.usda.gov/science/pdp/03data.txt
has the idea, but the problem is I can find the "2003 Data zip file" which this
site is refering to. - I have looked for it on the ms office 2003 cd,but I still
can find it.
Please can someone tell me where I can find de "2003 Data zip file"?
View 3 Replies
View Related
Apr 14, 2008
I have written a bit of code in a Microsoft Access 97. The code basically creates a Microsoft outlook message. I am trying to add in the message that I want to display in Outlook by using the MyMessage ="" command. But the message I want to add is too long to fit on one line of code - I get to the end of the line and can no longer type any more! I have tried to add the second part of the message to the next line but all I get is an "Expected line number or label or statement or end of statement" error message. I think this might be because access keeps putting a " at the end of the first line - every time I remove it and add the " to the end of the second line it keeps adding it back to the end of the first line!
any ideas would be gratefully received!!!!!
View 2 Replies
View Related
Dec 14, 2007
Hello all
I have a table containing the following fields:
Customer ID
Customer Name
Countries
The ID is numeric, the name is a string and the countries are the tricky bit since it contains a string of concatenated 2 digit ISO codes: "USCAGB".
What I would like to do is convert the concatenated representation to a normalized one. Take this example table:
ID Name Countries
2 John SEDK
3 Maria USCAGB
From the above table I would like to create a new table that links Customer IDs to single countries as
ID Name Countries
2 John SE
2 John DK
3 Maria US
3 Maria CA
3 Maria GB
How would I go about solving this?
View 4 Replies
View Related
Jun 20, 2014
The code has fixed path information on a lot of places in different SQLs (DoCmd.RunSqL command). I want to replace fixed path info with variable path info. Variable path info is stored in the table.
I managed to achieve that in the following manner:
Code:
Dim db As Database
Dim dbName as String
Set db = CurrentDb
Set rs = db.OpenRecordset ("TableName", dbOpendynaset)
rs.FindFirst ("ID = " & 2)
[Code] ....
where I would use as variable Function name instead of dbName.
How to make module that will enable to use Function name as variable path information for SQL queries?
View 10 Replies
View Related
Aug 19, 2005
I have a fax number field iwhich has a mask. +(000)-00-000-000 in a table of many records.
The problem is that every record has a number in the first part of country code +(001)which must have come there by mistakes, few records have complete and true fax numbers.
I need a query that can Update this Fax_Number field where the length of the string is less than 7 digits.
Some thing like UPDATE Contacts SET Contacts.Fax_Number = ""
WHERE ((Len("Fax_Number")>"6"));
How can i do this. Thanks.
View 4 Replies
View Related
Oct 18, 2006
How can I extract a string and from a textbox and make out that it is x (here x can be any value, e.g. 15) characters long??
View 1 Replies
View Related
Mar 8, 2006
Let's say I have a query like:
select [x]+[y] as A, [z]*[A] as B from MyTable.
I have found that sometimes this works and sometimes it doesn't, (Like, it works the first time I run it, but later quits working....)so I've gotten into the habit of repeating my calculations and writing it thus instead:
select [x]+[y] as A, [z]*([x]+[y]) as B from MyTable.
However, I now have some query fields that have so many calculations in them that I exceed the string length that Access allows for a query field. So is there a way to make the shorter SQL work consistently?
Any ideas appreciated.
Thanks!
PS: Here's the field I need to shorten:
AdjFcstDay: IIf(((Sum([AvgDaily])*First([forecastweeks])*5+nz(First([backlog]),0))/(First([forecastweeks])*5))+IIf([wiptotal]<(IIf(First(CDbl(nz([dailystddev],0)))<=0,0,xlnormsinv(First([lowwipflag]))*First([dailystddev]))),((IIf(First(CDbl(nz([dailystddev],0)))<=0,0,xlnormsinv(First([lowwipflag]))*First([dailystddev])))-[wiptotal])/5,IIf([wiptotal]>(IIf(First(CDbl(nz([dailystddev],0)))<=0,0,xlnormsinv(First([highwipflag]))*First([dailystddev]))),((IIf(First(CDbl(nz([dailystddev],0)))<=0,0,xlnormsinv(First([highwipflag]))*First([dailystddev])))-[wiptotal])/5,0))<0,0,(Sum([AvgDaily])*First([forecastweeks])*5+nz(First([backlog]),0))+IIf([wiptotal]<(IIf(First(CDbl(nz([dailystddev],0)))<=0,0,xlnormsinv(First([lowwipflag]))*First([dailystddev]))),((IIf(First(CDbl(nz([dailystddev],0)))<=0,0,xlnormsinv(First([lowwipflag]))*First([dailystddev])))-[wiptotal])/5,IIf([wiptotal]>(IIf(First(CDbl(nz([dailystddev],0)))<=0,0,xlnormsinv(First([highwipflag]))*First([dailystddev]))),((IIf(First(CDbl(nz([dailystddev],0)))<=0,0,xlnormsinv(First([highwipflag]))*First([dailystddev])))-[wiptotal])/5,0)))
View 1 Replies
View Related
Jan 22, 2007
In a database that holds membership records, I have three years worth of info relating to membership dues paid. I want to extract who has not paid a membership fee for the last three years, so we can strike them off our records, i.e. I have members' personal details, but there are no records in the payments table, nothing has been entered because they just have not paid. Do I run a query looking for a zero length string? Just how do I achieve this? Have I done right in not entering anything?
Help appreciated!
View 2 Replies
View Related
Jan 26, 2007
I am using VBA code to export a small table as a .csv file, which is no problem, except that the customer insists that where a field is blank, the .csv file must contain a pair of double quotes.
In other words, I can produce this:
"Field1","Field2",,"Field4","Field5"
but they insist on this:
"Field1","Field2","","Field4","Field5"
In the table design, I have made the default for each field = "", but I still can't seem to force the double quotes into a blank field.
Any suggestions will be welcomed.
View 2 Replies
View Related
Aug 16, 2005
Heyo, thought I'd toss my line to see if anyone has had a corruption like this:
Today I went digging through some of my tables on a db I've been building and noted that most (but not all) of my text fields had Unicode Compression/Off and Zero-Length-Strings/Allowed. Now, I know for certain that I never touch Unicode Compression and zero-length strings are not my bag in this db so I went to toggle these and I recieved 'Access encountered an error when attempting to save' type error when I, you guessed it, attempted to save.
So I built fresh tables, and imported my data, and all seemed well but digging further through my database I have noted that ALL of my tables seem to be suffering from this in some way.
First off, does anyone know what has happened?
Secondly, does anyone have a guess as to why this happened?
Lastly does anyone have a suggestion on how to rectify this?
I'm not a huge fan of building this entire gigantic db from the ground up and I'll do it if I need to, but I'd prefer to figure out what went wrong before we get there and it happens again.
Many thanks,
~Chad
View 1 Replies
View Related
Mar 14, 2015
I have strings of names in a calculated field named [CurrentDelReverse] that are separated by spaces, but some strings have 2 names and some strings have 7 names.
They look like this:
tjcrane becca002
shiel001 donohue ekaler
jpohl jhalling jsleifer laerwin chan ekaler
I need to separate the names, but I only need the first two names in two separate fields.
I am able to capture the first name with no problem using:
Delegatee: Left([CurrentDelReverse],InStr([CurrentDelReverse]," "))
My problem is trying to grab the second name in the list to show in a new column.
I have tried so many different things and the closest I got to solving it was:
Delegator: Trim(Mid([CurrentDelReverse],InStr(1,[CurrentDelReverse]," ")+1,IIf(InStr(InStr(1,[CurrentDelReverse]," ")+1,[CurrentDelReverse]," ")=0,0,InStr(InStr(1,[CurrentDelReverse]," ")+1,[CurrentDelReverse]," ")-InStr(1,[CurrentDelReverse]," "))))
This returned the second name in the list but ONLY if it had more than two names in the string.
View 7 Replies
View Related
Mar 30, 2008
Hey people,
This should be any easy one to solve:
I need to split a field in my query into two separate fields, e.g fullname into a first and last name, so "John Smith" will appear in two columns, "John" and "Smith".
Thanks in advance.
View 3 Replies
View Related
Oct 5, 2013
I have made a system for managing service calls and fieldworks.Part of this is checking the boards we install/service are working correctly.When the engineer calls in, we check the board - enter serial number, via ODBC talks to main server DB and pulls back what is listed below, along with ID and date/time which is all displayed in a list box.
9853911264,W-AMR,3,2:320:0:52,MAIN STORE,3.57,0,18,001.004.041,0,0*75
This works fine. In the string above are certain bits of information that need to be checked to ensure they are accurate and the board has been programmed correctly. What I want to do it, is when the user single clicks on the list box, it parses out the various sections of the above string and enters them into some text fields on the form. With some code these can then be checked to see if they are correct or not and alert the user if they are or not.
The checking part I can do, the part I am struggling with is parsing out the correct parts from the string.The parts will be the same parts required each time, and the string parts wont vary, just not sure how to go about it.
View 13 Replies
View Related
Nov 16, 2007
I have a txt file that I'd like to import, which contains answers to a test. The number of questions on the test varies year to year, but this year there are 110 (split in to two sections).
I'd like to import the file, so each answer is a field, and then score the answers against a 'correct' answer lookup table.
What's the best way of approaching this? I first thought of using vba to read the text file, split the text, and then use an SQL command to insert to to my table. This seems tedious (there are around 6500 respondents).
Anything else I could do instead?
Thanks,
Antro.
View 4 Replies
View Related
Jan 29, 2014
I've a code that can split strings. but now i want the last thing he split in a string named "name".
The string what is split is folder places like C:Usersinengine@mccain.comDocumentsTestvan e st.txt.
Now I want that text.txt comes in 'name'
View 2 Replies
View Related
Nov 5, 2014
I have the following code that creates a long string that works most of the time but sometimes gets cut short. I can't understand why it does this. When it cuts the string short it cuts it short in the same place. Everything gets in the string up to/or about the following code '</Practice Name>'This string is needed to upload info to a server.
Code:
dim msg as string
msg = "<?xml version=""1.0"" encoding=""utf-8""?>" & vbCrLf & _
"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & vbCrLf & _
" <soap:Body>" & vbCrLf & _
" <UpdateDataForScreens xmlns=""http://mdtoolboxrx.com/"">" & vbCrLf & _
" <PatientObj>" & vbCrLf & _
[code]....
View 10 Replies
View Related
May 1, 2015
I have to count the number of occurrences of Line feed (vbLf) in a long string. The code I am using is:
MAX = TLine.Split(vbLf).Length - 1
It does not work.
View 5 Replies
View Related
Jun 11, 2014
I have a continuous form that displays data from a table. What I am trying to accomplish is to change the format of the field if the string length is equal to 11, to "@@@-@@@-@@@@-@". Otherwise if it is greater or less than 11 then no format.
I have tried it using code:
If Len(Me.FormFieldName)=11 Then
Me.FormFieldName.Format = "@@@-@@@-@@@@-@"
End If
Is it even possible and if so is my syntax correct or am I way off base?
View 8 Replies
View Related
Apr 26, 2006
I know there are many posts on this but still cannot find what I want ....
I have a string ....
... <surname>bloggs</surname> <fornames>Jane</fornames> etc.etc.
... <surname>williams</surname> <forenames>Jo</fornames> etc.etc.
In a query I know how to:
Find the Start and End Postions as follows:
StartSurnamePos: InStr([string],"<surname>") returns 19
EndSurnamePos: InStr([string],"</surname>") returns 34
I also know that by adding 8 to StartSurnamePos I can get Bloggs but how do I stop it there.
Using left, Right or Mid how do I pull out just
bloggs Jane
Williams Jo in seperate fields?
Thanks in advanced.
View 1 Replies
View Related
Jan 25, 2005
I have a table field which long ago was merged from several other fields. When the data was merged into the field it was delimited by "1." then "2." up to "5."
Example: MergedField = "1.Animal 2.Large 3.African 4.Grey 5.Long Nose"
I now want to split it appart in a query where "1.Animal" goes into expression1, "2.Large" goes into expression2, etc.
I need to base the text on where the one number begins and grab everything until the next number in the mergefield is detected.
Can someone show me the syntax for this.
Thanks!
View 1 Replies
View Related
Jun 6, 2007
Hello
I have two tables with names of people in different forms.
table1 : [name] can be either in the form of :
- firstname & firstname surname
- surname, firstname
table2: [surname]
I'm trying to select all the records in table1 where [table2]![surname] is part of [table1]![name]
I've tried using
Like "*"&[surname]&"*"
This returns everything rather than the similar names.
I think this should be simple but can't work it out.
View 1 Replies
View Related