Convert Text (YYMM) To Numeric Retaining Lead Zero Or Zeros (Year 2000)
Aug 28, 2012
I have a DB containing over 4 million rows of data, each with a SALES_PERIOD based on YYMM. Our Developers set it up as Text, and index this item accordingly, I would like to format as numeric with the lead zero to allow quicker indexing, but when I format it it returns to text this is the formula I use?
I have a linked database that stores date values as YYMM in text format. I have no control over how that information is kept. I cant seem to find a way to convert YYMM text to date format. Additionally I would like to add the last day of the respective month to that data.
Im trying to construct a query which returns a field that has 21 different types of values.
Is there a way to assign a text value to each numeric value when the results are displayed?
Eg: 21 = "Local Sales", 22 = "National Sales", 23 = "International Sales".. and so on.
Ive looked at the Choose and IIF functions but I cant seem to work it out
..............
Anouther little problem, which should be basic. I want to exclude certain records with values such as 31 and 41 and 42.
When i type <> 31 or <> 41 <> 42 in the criteria they are all still displayed. Although when I type one of those criteria by themselves they ARE EXCLUDED. Is there something dumb I am missing here??
I have an ms access Database(2013 version). There are about 10000 records. There are some columns with field property of "short text" but contains the values like that 0.4,7, 9.0 etc I would like to convert the "short text" into "double" without loosing information.
I need to convert my text data to a number but when I convert using the VALUE function or use "format cells" to the numbers category, I loose the leading zeros. I need to keep them for sorting purposes.
I have a text field having data i-e HO-1, HO,2, ACW-25 and so on. The field name is nBadge_num and is Unique. The data in this field is sorted automatically like 1, 10, 11, 12, 13, 2, 3, 4, 5...because this is the text field.
The number on the form is automatically generated, when the user type HO- for example on field exit event. The last number will generate like HO-5.
Code for automatic number generation is:
Dim dbs As Database, rst As Recordset, Response Set dbs = CurrentDb Set rst = dbs.OpenRecordset("SELECT Max(Right([nBadge_Num],Len([nBadge_Num])-" & Len(Me.NBadge_Num) & ")) AS MaxNo " _
[Code]....
My problem is when the number is generated it give HO-5 instead of HO-14, How can I sort the numeric part of the field ?
I don't know VBA and I am not a programmer. I have a table with locations identified by latitude and longitude. I have separate fields for degrees minutes seconds and decimal degrees. For example, 50 degrees 30 minutes 0 seconds is also stored as 50.5 degrees. I have a radial search query that finds all targets within a given distance from a location. The three fields input by the user are latitude, longitude and distance. The problem is the query only works with decimal degrees. I want the user to be able to input in a format like "50 30 0". How do I convert a character string with non-numeric characters to a numeric string?
I have two fields set up on a form, when the user double clicks in field 1, the text that was in Field 1 then moves to field 2. The issue is that the text in field 2 only retains the most recent text change - overwriting the text that was in field 2 previously. How do i make it so that every time the text moves to field 2, that it keeps a running history of the text?
I have data that looks like this: 3-KJ56, 1-85L6. I am importing data from excel. (This was exporting from another inhouse database program into tabdelimited, into excel, ect)
There are times that I get data that is mistaken for a date:
1-5600 (jan-5600) This is how it is in Excel, before I load it up into access. I use an update Query to correct this mistake
Month([Datafield])& "-" & Year([Datafield])
BUT..... When Access sees years like "5600" it comes back as "2000" or "8956" comes back as "1956".
When I use the year() statement in Excel, it comes back with the correct year- but not access.
Is there a statement that will force Access to see the entire 4 digit year?
I have a trail version of access 2007 at home which I work on and i want to continue working on my database in 2000 at work. how can i convert it because when i try all hell break loose?
It's not letting me open it since i did it in 2003, and im trying to open it now at home in 2000. I'd really appreciate if anyone can help me convert it and then attach it...thanks :o
I have an inherited database with years worth of julian dates stored as numbers (e.g. days 1-366 for a leap year). I also have some fields stored as short dates. I would like to run a series of parameterized queries on this data, some using the short data and some using the "julian dates" that are actually just numbers. I have the user enter the start and end date in short date format and would like that to be converted and held in an unbound field as a number value. So far I can get the date to appear as a "julian date" (e.g. 1/1/08 appears as 1, obviously the underlying data is still 1/1/08) How do I take that 1 and convert it to number value "1"? Thanks in advance.
AssumptionMo AssumptionYr MAY 2014 JUN 2015 JUL 2015 OCT 2016
I need to create a field called AssumpDate that converts the month into a date field on the 1st day of the month. ex May 2014 needs to read 5/1/2014. When I use the expression AssumpDate: DateValue("1-" & [Assumption_Month] & "-" & Year(Date())) of course the year changes to the current one--2015. How can I I change the expression so that the year is based on the AssumptionYr column?
In a query I would like to extract the last ten years. This is what the data looks like:12/13 (Data type = text)(Short for 2012/2013 which actually represents 7/1/2012 to 6/30/2013.)
I am able to extract the "12" and turn it into the general number 2012 using: ("20" & Left([TAXYR],2))*1..But how can I convert that to the data type-date so I can include those records in the past ten years from todays date? I was trying to use DateAdd but I think the problem is the data type and where converting to date gives me "1905" or "9/##/1905." I get why it does that, but is there a workaround? Maybe adding 39,785 days?? (2014-1905)*365
I'm learning as I go and this is probably a basic question but if I have an alpha numeric field of variable lenght, i.e. AUI856Z....how to I format it so that it is 19 characters long with leading zeros, i.e. 000000000000AUI856Z.:confused:
I'm trying to set up an import of an Excel file. One field in Excel, "Sales Tax" has a lead space, so " Sales Tax" is its Excel name. Since I can't name a field in Access starting with a space, the only way I know to import properly is to manually remove the space from the Excel file. While this isn't actually that difficult, I'm trying to avoid this manual step if possible.
A few years ago I’ve made an access database on access 2000. The problem is that now I’ve installed the office 2003, and I can’t make the database work properly.
At first says that are missing those files: “tshoot.ocx”, “msioff9.ocx” and “msowc.dll”; so, I’ve copy them from another computer using office 2000 and now only complains about “msioff9.ocx” saying that my database contains a reference incomplete to it.
Is there no other way to convert my database do work properly with access 2003? What can I do?
I have made my Search Form that will search through my tables, some how I have a syntax error for the following: year, Section and ID, these fields are not text I use numeric values so I think the search is not working for that reason, I am not sure how can I fix it though do I have do add val() or sth.
Private Sub Command8_Click()
On Error GoTo Command8_ClickError
Dim db As Database Dim rs As Recordset Dim rs2 As Recordset Dim strWhereCondition As String Dim strSql As String
strWhereCondition = "" strSql = "Select distinct Id From AcademicVideo Where True "
'================================'
If Not IsNull(ID) And Trim(ID) <> "" Then strSql = strSql & " And [Id] = " & [ID] End If
'================================'
If Not IsNull(Course) And Trim(Course) <> "" Then If InStr(Course, "*") = 0 Then strSql = strSql & " And [Course] = '" & [Course] & "'" Else strSql = strSql & " And [Course] like '" & [Course] & "'" End If End If
'================================'
If Not IsNull([Format]) And Trim([Format]) <> "" Then If InStr([Format], "*") = 0 Then strSql = strSql & " And [Format] = '" & [Format] & "'" Else strSql = strSql & " And [Format] like '" & [Format] & "'" End If End If
'================================'
If Not IsNull([Title]) And Trim([Title]) <> "" Then If InStr([Title], "*") = 0 Then strSql = strSql & " And [Title] = '" & [Title] & "'" Else strSql = strSql & " And [Title] like '" & [Title] & "'" End If End If
'================================'
If Not IsNull([Lecturer]) And Trim([Lecturer]) <> "" Then If InStr([Lecturer], "*") = 0 Then strSql = strSql & " And [Lecturer] = '" & [Lecturer] & "'" Else strSql = strSql & " And [Lecturer] like '" & [Lecturer] & "'" End If End If
'================================'
' If Not IsNull([Section]) And Trim([Section]) <> "" Then ' If InStr([Section], "*") = 0 Then ' strSql = strSql & " And [Section] = " & [Section] & "'" ' Else ' strSql = strSql & " And [Section] like " & [Section] & "'" ' End If ' End If
'================================'
If Not IsNull([Semester]) And Trim([Semester]) <> "" Then If InStr([Semester], "*") = 0 Then strSql = strSql & " And [Semester] = '" & [Semester] & "'" Else strSql = strSql & " And [Semester] like '" & [Semester] & "'" End If End If
'================================'
If Not IsNull([Year]) And Trim([Year]) <> "" Then If InStr([Year], "*") = 0 Then strSql = strSql & " And [Year] = " & [Year] & "'" Else strSql = strSql & " And [Year] like " & [Year] & "'" End If End If
'================================'
If Not IsNull([Description]) And Trim([Description]) <> "" Then If InStr([Description], "*") = 0 Then strSql = strSql & " And [Description] = '" & [Description] & "'" Else strSql = strSql & " And [Description] like '" & [Description] & "'" End If End If
'================================'
Set db = CurrentDb() Set rs = CurrentDb.OpenRecordset(strSql, dbOpenSnapshot) ' If (rs2.RecordCount = Null) Then
' MsgBox "Enter A valid Record"
If (rs.RecordCount = 0) Then MsgBox "Could Not found "
Else strWhereCondition = "[Id] In (" & rs!ID Do While Not rs.EOF strWhereCondition = strWhereCondition & ", " & rs!ID rs.MoveNext Loop strWhereCondition = strWhereCondition & ")" End If rs.Close
If strWhereCondition <> "" Then DoCmd.OpenForm "ACVideo", acNormal, , strWhereCondition DoCmd.Close acForm, "Search AcVideo" End If
In excel spreadsheet, when I eg type in a numeric column 10 1500 so on, I would column11 appear text such as one thounsand and five hundred. How can I convert this?
I am importing data to a program that requires the life of an item. This is in months such as 241 months. The valid format for this program is YYMM. 241 = 2001 or 20 years 01 month.
Another example: 16 months should read 0104 or one year 4 months.
Any idea how to convert this to yymm format based on the number of months?
I am importing a file that has two numeric fields in it. I was asked to import as fixed length text fields with leading zeroes and no decimal point.
I am supposed to export the data in Csv format.
Source field from IBM iSeries DB: quantity is 15,3. Quantity source value is 9, requested text format of five characters 00009, the Csv result is 9. The field in Access is defined as Text 5 characters.
Source field from IBM iSeries DB: price is 17,4. Price source value is 1020.0000, requested text format of nine characters 000001020, the Csv result is 1200.00. The field in Access is defined as Text 9 characters.
I have a number of categories on which I assign a relative risk - at the moment H, M and L. Previously I had these set as a value selection combo and they were as 'text'.
More recently I have changed this now to a lookup and put the risk rating into a separate table. As a consequence the field is now 'numeric' but displays text from my combo.
When running a linked query I now get an error message instead of the required response.
My query should report back a 'Yes' if the queried cell contains an 'H' or 'M'.
Audiometry: IIf([tblRiskProfile]![Noise]="H" Or [tblRiskProfile]![Noise]="M","Yes","No")
However, this obviosuly doesn't work now because of the cell properties being numeric. How do I ammend the string above to run the same query?