Modules & VBA :: Check If String Contains Numeric Characters?
Nov 7, 2013
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 would like to cut off the first 6 and last 2 Charaters in an after update event but not sure how, I cannot use mid as the length of the string may change but never the first 6 or last 2, can some one show me how it's done ...
I'm trying to check a directory for a folder name which has a certain string in it (RecNum)
However the fso object filesys.FolderExists does not take an argument when looking for part of a folder name on a particular path.
What I basically want to do is look in a directory for a folder with the RecNum variable as part of the folder name. if it exists open it, if not create it.
Set filesys = CreateObject("Scripting.FileSystemObject") If filesys.FolderExists(targetdir) Then GoTo function_end MkDir targetdir If filesys.FolderExists(copypath) Then filesys.CopyFolder copypath, targetdir End If MsgBox ("folder created") function_end:
I have got like subform which I think is the tech term I use it to filter dates on field "date raised" and open's a report depend on date's entered in txtstartdate and txtenddate it works perfectly but I need to add some check boxes to check other field's are true/false ...
Code: Private Sub cmdPreview_Click() Dim strReport As String Dim strDateField As String Dim strWhere As String Dim lngView As Long
[Code] ....
I need to add code to the text in red well I'm guessing
here goes with what I would like to add job cancelled1 check box name field name= job cancelled job on hold1 check box name field name = job on hold void property1 check box name field name = void property
E.g. if I put date range in my date boxes and tick job cancelled show all record in that date range cancelled same with job on hold and void property
here some code I did but wont work as it not in the same strwhere above
Code: if me[job cancelled1] = true then strwhere = [job cancelled] = 1 'field name else strwhere [job cancelled] is null end if
Some how need to add the strwhere to the code above ...
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?
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 need to make a query to compare equality of two pieces of data, one is a 6 character fixed-length text string (where the first character can be ignored) and the other is a 4 or 5 digit number (long integer, if 4 digit number can be assumed to be 5 with a leading 0).
I do not have the ability to change the way I receive the data, they are on linked tables of different customers.
I tried using various SQL functions to convert the data in the query but they don't seem to work in Access, so I am getting "Type incorrect in the expression" errors.
How do I do this in ACCESS? I would prefer a SQL query solution to a VBA solution if possible, the data is updated VERY often and the application is already doing too much processing on the form_timer() event.
"Att Mr/Mrs Vezi Your DEFAULTED account has been handed over to XXX. Payment DUE IMMEDIATELY Ref 1315519509. Tel 0009377500"
I need to extract the word "Ref " plus the number that follows it from the above string. The problem is that the word "Ref " is not always in the same place and the number following it is not always the same length. (ie it could look like "Ref 123456 " or "Ref 1234567 ") The only commonality between the records is that the number will always follow the word "Ref ".
I need to be able to strip the last 21 characters from the following strings using a command in a query. Any ideas? I know I need to Instr command but not sure how to do it.
I am new to VB and want to know how to chop the last three characters off a string. Am writing dynamic SQL and have to take the AND off the last WHERE clause if needed.
My DB is on SQL Server with an Access adp front end.
SQL uses the Windows NT user name and password for security and also pulls in the user name into a field in every record so we know who has added and modified it.
For one table we are actually using the user name field on the form and in a report for reasons other than security.
The user name is filled in with first the name of the network group, then a slash, then the user name itself. So there are 7 characters I don't really care about.
Is there a way in VBA to remove those first seven characters and only show what comes afterwards? Thanks for the help!
I have the following string: NE1220904 I need to remove the left two characters and the right four characters of a string in a query. I have found how to remove one side or the other, but not from both sides. Thanks in advance for the help!
In MySQL I can use the LEFT(3, field_name) command, but I essentially want access to pull all records from a table where the the first three digits of a number field match those pre-selected by a form drop down.
This database is in Access 97. Is there a way to compare the first x number of digits using SQL only, or do I need to run each line through code first, and then check it (I really don't want to do that)?
example numbe rin field:
123456789
SQL checks to see if 123 matches value selected on a form.
I'm familiar with writing a replace query to replace characters or strings but what I'm trying to do this time is a bit unique to me. I have a string of numbers that will either be 8 or 9 digits in length. The first 1 or 2 digits will be the State code (1-50 hence the discrepancy in number of total digits), then a 2 digit agency code, then the last 5 digits are a producer code. What I need to do is change the 2 digits for the agency part both to 0. So basically characters 6 and 7 if you're counting from the right. To me it feels like I'm trying to do it backwards so I'm having a hard time writing it.
I have an input box and wanted user just to input 7 digital data. However, I am afraid user may enter string data. Is there any way to check and ensure user can only input 7 digital data to that input box?
I am writing some search results to an excelsheet for reports using the time and date functions to build a filename. I downloaded a StripSpecialCharacters() module, but it doesn't take them all out (only takes ascii above 127).
Does anybody know of another function to do it. searched the archive to no avail.
I have over 270,000 records in my database with 4 fields. And for each field I need to make sure they dont go over a certain number of characters for example field1 can't go over 20. Is there a way I can make sure that they don't go over that? When I go to design view and go to the Data Type of each field I change the filed size to 20, but if something is imported into that field that is over 20 characters long will I get a message saying it won't import? Or can I write a query to check the whole field to make sure that nothing is over 20 characters?