I have been downloading .csv files from a construction website that we use to following projects as they develop. I import the file into Excel and then want to bring it into my database. The issue is with two fields I have that are numeric, however, when downloaded into Excel, the information in the two fields now have an (')added to the beginning and end of the string, i.e. and the second field has an (') and (-) to the data.
'201400409710' '201300697683'
The second field is a zipcode field that comes in like this:
'14063-1127' '14222-1004'
I would like to design a query to strip the ' from each field as well as the (-) in the zipcode field.If I have to write 2 separate queries that is fine.
I have a database that is used for tracking changes to numerous courses. Part of this database create a unique tracking number for each course problem developed. Currently I have the form do a comparison using the highest most number to compare against the current number assigned and prevent the form from saving until the number is incremented and not a duplicate, it would be a lot easier if I could just have it increment plus 1. I have seen various answers but they all seem to depend on the alpha portion of the field being a set value, in my instance it is variable in length. The only part that is fixed is the last four characters to the right which are the numeric portion I would like to increment. For example the field can equal:
QACP-M-PIQ-6059 QACP-M-PREF-6002
how to extract just the numeric portion, increment it by one and save?
I need some kind of function (I been told) that generates 3 different alphanumeric autonumbers in the same field when adding a new record, starting such field from A-1, B-1 and C-1 to infinite.Because the record gets inserted in the table with an append query and not manually through a form, I believe the function should be placed in the Default Value setting of the field.
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 am trying to create a query that will return the max value of small groups of alpha numeric fields. The numeric portion is the same for a series/group of items, but the alpha increments. Example: (I color coded the numeric groups for ease of reading)
Unfortunately, I do not have any other fields that I could use to help. I was able to create two calculated fields one with the numeric portion and one with the alpha portion, but then didn't know how to remove the unwanted ones. Also, every value is the same size, 7 numbers, one dash, four numbers, and one letter. My table has around four thousand records or so.
I thought of writting a VB app to single step and compare, but I am hoping there is a better method.
I have been pouring over this site and trying all kinds of things that end up failing. I am not a novice, but obviously not an expert.
Is there an easy way in VBA to loop through a recordset and determine if the text string in a text field includes numeric characters?
I'm trying to do something like this:
Code: Do Until rst.EOF rst.Edit If Left(rst!FldText,10) contains any numeric characters Then rst!FldType = "Mixed" ElseIF Left(rst!FldText,10) contains "PO" Then rst!FldType = "PO" Else rst!FldType = "Std" End If rst.Update
I'm trying to create a validation rule that requires an input of 5 numeric characters OR if the entry begins with a letter it can be any length. For example if the record begins with a number the length must be 5. If it starts with a letter any length is acceptable.
I have a table that has several fields including CallID (autonumber) and SKU (text)
SKU can be anything up to 9 characters, sometimes numeric sometimes alphanumeric. For example: 24300, AA23145, G58d444, 24999, 89332,...
Based on the Count of CallID I can easily get the top20 calls on each SKU. This is the query I use for that:
Code: SELECT TOP 20 Count(Calls.CallID) AS CountOfCallID, Calls.SKU FROM Calls GROUP BY Calls.SKU HAVING ((Not (Calls.SKU) Is Null)) ORDER BY Count(Calls.CallID) DESC;
The problem is that now I have been asked to create two different lists. One that has the top 20 SKU that range from 24520 and 24599 and another one that does the res tof the SKUs.
Obviously my problem is that the SKU field is text, not numbers so I can't just limit the results in the query by using "Between 24520 and 24500" in the query criteria.
Hi I wish to check my phone number fields for non-numeric characters. If the field contains 0-9 then I want to keep the field otherwise I want to replace the contents with a null. Can you please help? Noel
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?
On a form, is it possible to have #### appear in the form box when it loads and then the user would type a 4 digit number in place of ####.Also, for the table associated with that form, how do I limit account numbers to a 4 digit numeric value?
Is there a way to limit the number of characters that can be entered into an unbound textbox on my form?
I have a search textbox, where a jobId is entered and button is clicked to search. The numbers are generally 8-digit. I just noticed one of my users trying to enter 9489858939349839434 :eek: ohh lawd. Please help me stop these people before they break my db...
I have a data entry form with a memo control physically sized to match the allowable space for this information when printed on a report.
Basically, I need to be able to stop the user from further input when the cursor reaches the lower right corner of the memo control. Beeping when reaching the limit is acceptable, but a pop-up message would be ideal.
I have not been able to find a solution that will limit the amount of text displayed in the memo control that will also include however many LF's a user inputs. All of the search results refer to only limiting the number of characters and do not take into account LF's.
I am new to Access and would appreciate all suggestions.
I have 2 databases with the same structure, but different data.
I want to put all the data in 1 database.
The problem is that the most important table (clients)has an autonumeric id field, that is used to link the records to the fields of many other tables; so, I cannot delete or change that field without losing connections.
I've got some code that loops through a record and copies the non-null fields to another record. This is the partial code:
For Each fld In tdf.Fields If Not IsNull(Forms!contact_lookup![Contact_sub subform1].Form(fld.NAME)) Then strSql = "UPDATE tbl1 SET tbl1.[" & fld.NAME & "] = '" & Forms!contact_lookup![Contact_sub subform1].Form(fld.NAME) & "' " & _ "WHERE tbl1.[FC_APN] = '" & Me.txtApn & "';" DoCmd.RunSQL strSql End If Next fld
This works fine until it encounters a field whose contents has a reserved character, like a single quote (" ' ") in it, for example, "What's the what." At that point the SQL thinks there's a " ' " missing in the statement, and I get an error 3075 (syntax error: missing operator).
Two Solutions to address moving an Access Memo field into Excel when string has > 255 characters. All my 'reports' use Excel VBA (Access Reports are not used). The Excel reports can have 40,000 records. Speed to create the report can be an issue.
Describing 2 Solutions below to address moving Access memo fields with > 255 characters into Excel.After running this code
Code: 720 ObjXL.DisplayAlerts = False ObjXL.Columns("X:X").Select ObjXL.Selection.NumberFormat = "@" ' set column to Text 730 ObjXL.Worksheets(intWorksheetNum).Cells(intRowPos, 1).CopyFromRecordset rsNutsAndBolts
The Comments column are limited to 255 characters. So, the CopyFromRecordset (recordsetvariable) creates the 255 character limitation.
The reason? The 255 character limit is because CopyFromRecordset sutomatically uses the Characters property of the Range object. The 255 limit would not be there if the Cell Value property is used to assign the string to that cell.
Dim sRx as String ' String Prescription sRx = "String with > 255 characters ... you fill in the rest ...." Cells(1, 1).Value = sRx ' Cell's Value property assignment can be very large
Solution 1:
The record set is still in memory. By using a loop, a cursor can start with record 1 (memo column) and assign that value to the Excel row / column using the .value as shown above. Basically, this moves one memo field at a time, record by record. e.g. Read First recordset in Access, copy to variable, assign value to Excel row/column Then move next on each Access and Excel.
Solution 2:
An Access Memo filed [RxNotes] can have up to 750 characters. Cut it apart into three new fields that end up out in the very right Excel columns AA, AB, AC.
Note1=Mid([RxNotes],1,250) Note2=Mid([RxNotes],251,250) Note3=Mid([RxNotes],501,250) Then using Excel Object - Concat the cells back cell by cell... X2=CONCATENATE(AA2,AB2,AC2))
Then delete the columns AA, AB, AC to hide the evidence..Neither solution is all that elequent. Read about this and by golly, it made a difference
ConcatComments = "'" & CommentString
Before using the CopyFromRecordset be sure to add a single quote in front of the large string.
Turns out the interface between Access and Excel look for this to prepare Excel immediately for the string to be a string, not something else. Some of my strings had weird print characters that kind of looked like Japenese characters. It seemed random, it always happened if the string was 255 or more characters (ramdonly, not always). The single quote doesn't show up in Excel, but got rid of all the noise.