Need Assitance With Inserting Dashes

Dec 12, 2006

I have a very large database with record that are from 3 to 11 characters long. I would like to run a query to inset dashes at position 5 and 9 so a part number would look like this 0000-000-0000 or following the same convention but never dashes as the last character
this is what i currently have
UPDATE stihl SET [part number] = left([part number], 4)& "-" & mid ([part number], 5);
then run a second as follows

UPDATE stihl SET [part number] = left([part number], 8)& "-" & mid ([part number], 9);

the problem this adds dashes after numbers shorter than 11 and 2 dashes if on 4 long.

Any ideas thanks in advance

View Replies


ADVERTISEMENT

Looking For Assitance With Coding Help

Jul 20, 2007

I have the following code that will import OLE objects into access, and it works quite well...but, how do I get it to check to see if a reocrd already exists and not to duplicate a reocrd? I am not a programmer, I have a couple of ideals but I don't know where to start. Any help would be appreciated.


If I were to put a new file into the folder, I would like the code to only import the new file and all files again. Which currently it will just create new reocrds for the existing document. I hope I have explained this... Any help would be appreciated. Thanks. vb Code: Original - vb Code Private Sub cmdLoadOLE_Click() Dim MyFolder As String Dim MyExt As String Dim MyPath As String Dim MyFile As String Dim strCriteria As String MyFolder = Me!SearchFolder ' Get the search path. MyPath = MyFolder & "" & "*." & [SearchExtension] ' Get the first file in the path containing the file extension. MyFile = Dir(MyPath, vbNormal) Do While Len(MyFile) <> 0 [OLEpath] = MyFolder & "" & MyFile [OLEFile].Class = [OLEClass] [OLEFile].OLETypeAllowed = acOLEEmbedded [OLEFile].SourceDoc = [OLEpath] [OLEFile].Action = acOLECreateEmbed ' Check for next OLE file in the folder. MyFile = Dir DoCmd.RunCommand acCmdRecordsGoToNew LoopEnd Sub Private Sub cmdLoadOLE_Click()       Dim MyFolder As String       Dim MyExt As String       Dim MyPath As String       Dim MyFile As String       Dim strCriteria As String                MyFolder = Me!SearchFolder       ' Get the search path.       MyPath = MyFolder & "" & "*." & [SearchExtension]       ' Get the first file in the path containing the file extension.       MyFile = Dir(MyPath, vbNormal)       Do While Len(MyFile) <> 0          [OLEpath] = MyFolder & "" & MyFile          [OLEFile].Class = [OLEClass]          [OLEFile].OLETypeAllowed = acOLEEmbedded          [OLEFile].SourceDoc = [OLEpath]          [OLEFile].Action = acOLECreateEmbed          ' Check for next OLE file in the folder.          MyFile = Dir          DoCmd.RunCommand acCmdRecordsGoToNew       Loop End Sub

View 1 Replies View Related

Relationship Issue? I Need Some Assitance From The Experts On This One.

Jan 6, 2006

Forms used:
frmAnnualService
frmPostCardback

Tables used:
tblAnnualService
tblCustomers

I have a database created containing 2 tables. (tblAnnualService and tblCustomers). I have the Repair Order set as the primary key in both tables since it should never have a duplicate. I have a one to one relationship, enforce referential integrity and I have cascade updated related fields. The join type I chose is 3. Include ALL records from tblCustomers and only those records from tblAnnualService where joined fields are equal.

I have a couple issues ongoing at the moment. I have a button on the master form (frmAnnualService) used to input service information for each customer. This button runs and update query that updates tblAnnualService and all fields on this form are bound back to tblAnnualService.

With the setting on the relationship as listed above neither one of the tables is being updated. When I change my relationship and remove enforce referential integrity and cascade updated fields, change join type to 1. Change only include rows where joined fields from both tables are the same the tblAnnualService updates but the tblCustomers does not.

I have another form (a postcard mailer frmPostCardback) that is bound to the tblCustomers. I need to be able to from the frmAnnualService input the data, click the update query table button and have it update the tblAnnualService and the tblCustomers. I assume I do not have my relationship setup correctly. Can someone please assist? I some background with Access but need your comments to be specific and detailed so I can make sure I am correcting the issue properly.

Thanks in advance for any assistance I receive.

View 6 Replies View Related

Spaces, Underlines And Dashes

May 1, 2007

I have a db, that I used to maintain as a end user, now it's in a multiuser environment, problem is the user has to enter job numbers.
Below are all valid job numbers, therefore a mask will not work.
So I was thinking "HOW" could this be done, perhaps eliminating Spaces, underlines and dashes from this field. How would I do this on the same field for all 3 conditions (course i would have to backtrack)

01-AB134
02-091
2-2177
3-715
03-021-A
05-001-PBPL
07-07-955

View 4 Replies View Related

Query Takes Dashes Out Of SSN

Dec 4, 2007

I know this is probably the dumbest thing to ask, but I am just not getting it. I'm tryin to run a Query, and I assume it's a SELECT query for Last Name, First Name, SSN. The tbl containing this information [tbl_Employees] automatically places the dashes in the SSN through an input mask. However for one type of report I will later need to generate, the SSN cannot contain the dashes.
What is the criteria for this?!? I am so lost! I know it's probably something so simple that I'm just overlooking it, but I'm clueless. Can someone help me out? Thanks so much! :)

View 14 Replies View Related

How To Create Autonumber With Dashes

May 8, 2013

I need to create a Autonumber field in a table with the following starting value 13-642-2000.

View 5 Replies View Related

Dashes Are Causing Problems Retrieving Data

Aug 2, 2006

I have a database with a series of fields, all set to a String datatype, that I want to be able to fill and then use with MS Word as a mail merge data source. This function lets you query a MS Access db and use the results to fill in predefined spots attached to the various data values in the table. This is great for my needs however a large percentage of times that I have a dash in the value being queried it does not return any results. For example, 01-01 would return no entry found even though I can clearly see it in the database, however it would work fine if I queried for 0101 or any other value in the given field.

Basically I'm trying to figure out why dashes would cause problems. They are obviously fine for being stored in the access database and don't cause any troubles until they are queried for, also retrieving data containing dashes is fine so long as that value is not the one being queried for.

I basically can't avoid the dashes in the data for this setup and as such hopefully can figure out why this happens and how to get around it. Thanks for any help offered.

View 1 Replies View Related

Queries :: Convert Phone Number In Text Format And Remove Dashes Or Parenthesis

Aug 7, 2014

Is there a way to convert a phone number in text format into a number and remove any dashs or parenthesis. What function can I use ?

old format (951) 244-3011
new format 9512443011

View 2 Replies View Related

Error At Inserting New Value

Jan 24, 2006

i got the atached message when i am trying to insert a new value, the wierd thing is when i do okayu, the value is being insrted...

View 5 Replies View Related

Need Help Inserting Table

Jul 31, 2006

I have a database that contains a few tables and queries etc. I made a copy of this database so that I could change some of the VB code with out affecting the database information. I have completed all the code and now I want to input those old tables into my finished verion. I am not sure how to do this. Any ideas on how I could do this would greatly be appreciated. Thanks.

View 8 Replies View Related

Inserting A Video

Feb 26, 2007

Hi
I really need to insert a movie in my database. I have tried inserting a Windows Media Player object in a form, but I dont know how to link it to a movie on my computer. Please help me with this. By the way I'm using DAO, if that helps at all.

Please help me as soon as possible, I'm in a hurry
Thanks in advance

View 4 Replies View Related

Inserting Columns

Dec 30, 2004

i am working on my company's database which is in access 97, and has a backend. the normal entry way when you add a column it wont save as it says it can't save propertys to a linked table. i added the required fields to the backend without any problems and saved and exited. now when i go into the "frontend" the fields arn't showing up on the table. any ideas?
thanks
briar

View 6 Replies View Related

Inserting Records...

Aug 4, 2005

Ok, I know this is already part of another thread, but my problem is a bit more complex...

The database I've been designing catalogs traffic signal equipment at every intersection in a 12-county area. There's about 480 intersections in the database. My boss pointed out the need to have the intersections listed in geographic order. For example, if I have three intersections on IL Rte. 5 - John Deere Rd, Bauer Parkway, and Industrial Park Rd, they need to be listed in the order in which they exist on the road (from east to west or north to south). Alphabetically, the intersections would be Bauer, Industrial, John Deere. But, as you drive down the road (from east to west), the intersections occur as Industrial, Bauer, and John Deere.

I can sort the intersections according to their "corridors" without any trouble, but I have to force the geographic order of the individual intersections by assigning each an index value (like "1", "2", and "3"). Better yet, I can assign the indices in multiples of 10, 100 or 1000, (1,2,3 becomes 10,20,30 or 100, 200, 300, etc.) and guarantee there will likely always be a sequential position available in the geographic index for a new intersection. Plus, I can always pick the "middle" of the range for each new insertion. For example, if Bauer has a geographic index of 200 and John Deere's is 300, then I can give Zebulon a value of 250 - leaving equal room for insertions before and after Zebulon in the future.

Pulling this off isn't hard - I know how to do it. The problem is running out of positions in the index. In the case of my database, it is unlikely we'll ever add more than two or three intersections between two existing ones, so using multiples 100 is probably best. In this case, I can add at least 6 intersections before I run into the possibility of having two intersections whose indices have a difference of only 1. Using 1000, the value goes up to 9. Each multiple of ten gives you 3 more entries (minimum) before encountering consecutive indices. I guess the inherent problem is figuring out a more "infinite" way of accomplishing this. I don't readily need it, but on the off chance that I do end up with consecutive intersections (that I have to insert between), it'll require manual re-numbering to fix the problem.

That's my solution, but there may be something simpler. Any thoughts?

View 7 Replies View Related

Inserting Into A Table

Apr 23, 2007

just wondering if anyone knows how to insert about 10 lines of data into an already existing table?

View 3 Replies View Related

Textbox Value Not Inserting

Jan 23, 2007

Hi,

Can anyone tell me what i'm doing wrong with this insert statement?


INSERT INTO TBL_PROCESS_NAME
VALUES( ' & [Forms]![frmIntroduction]![txtProcess_Name] & ' )


the form is loaded when the query is run, i've tried taking out the & and the ' but to no avail, all i get in the table is [Forms]![frmIntroduction]![txtProcess_Name]

Thanks

Michael

View 7 Replies View Related

Inserting Into A Table With 2 Pks

Apr 5, 2007

The security table is made up of two primary keys: thing, personorgroup
When i run this statement to insert into the security table

INSERT INTO security (thing, personorgroup, accessrights)
SELECT '252600649', '4020', '255'
FROM PROFILE
WHERE not exists(select * from security
where security.thing = '252600649' and security.personorgroup = '4020');

I get this error:
Server: Msg 2627, Level 14, State 1, Line 25
Violation of PRIMARY KEY constraint 'PK_SECURITY'. Cannot insert duplicate key in object 'SECURITY'.
The statement has been terminated.

Anybody know how i can perform my insert successfully? :D

View 9 Replies View Related

Inserting Value In Table

Sep 23, 2004

i am trying to achieve a simple thing (at least it seems so to me!)...
I am trying to add a new record to a table (LP_Product_Name) with only one field (Product_Name) as a part of a 'on Lost Focus' event of a text box (txb_ProductName).
Code:Private Sub txb_productname_LostFocus()' Declare Variables Dim db As Database Dim rs As DAO.Recordset Set db = Nothing Set rs = Nothing' Assign Values to Variables Set db = CurrentDb() Set rs = CurrentDb.OpenRecordset("LP_Product_Name")' Enter New Product name to the table With rs .AddNew .Fields("Product_Name") = Me.txb_productname End With ' Close variables Set db = Nothing Set rs = Nothing' Restore Visible formMe.cmb_productname.Visible = TrueMe.cmb_productname.SetFocusMe.txb_productname.Visible = FalseEnd Sub
When I type something in the textbox and shift focus to another field, nothing happens... no error message and no added value to the table! I dont know what is going on. It just doesnt work!

On the same form I also have a combo box that uses the same table (LP_Product_Name) as its rowsource. I want the Combo box to immediately show this added value.

Can someone please help!?!
Thanks!

View 7 Replies View Related

Inserting Values

Nov 16, 2006

HI,
I would like to insert values to differetn tables using a form, is that possible with just access? or does it need VB script or SQL, if so, is there any example to follow.
my form made of a combination of two tables attributes ad when I enter say:

name
tel number
address
car
car reg
booking time

then I would need that info to go to the table it belongs to, as there is three tables, one is the car, the other is customer and the last is booking.
thanks

View 1 Replies View Related

Help With Inserting Date

Jan 8, 2007

Hi All,
This should be a simple thing however Im having some problems. Im trying to insert a record into access. I can insert everything except the date. I cant seem to get the right format. Below is what Im trying:
Code:strSQL ="INSERT INTO GISrequest (givenName, surName, email, division, title, purpose, audience, date) VALUES ('firstmname', "&strVal1&", 'anemail@somewhere.com', 'thedivision', 'thetitle', 'purposestring', 'audience',#" & AccessDate(NOW()) & "#)"

I think the error is in how I format the date, but Im not sure. Ive looked on the net for examples but I havent found anything that works... can someone suggest what may be wrong or perhaps provide (or point me to ) an example of inserting a date into an access database with ASP?

Many Thanks

View 3 Replies View Related

Inserting Error???

Jan 10, 2007

hEYA all, ive got a problem, im trying to inserting data from an array to my access table- but cant do this due to this error:-Data type mismatch in criteria expression.

Heres my insert code- which its genereating the error at:
Code:sub InsertDBCmd( )'================================================= ========================================SET objRs = SERVER.createObject( "ADODB.recordSet" )dim sqlStatmentsqlStatment = "INSERT INTO Members "sqlStatment = sqlStatment & "( "sqlStatment = sqlStatment & "[A/C no], [Address_Code], "sqlStatment = sqlStatment & "[Managing Director], [Title], [Buying Group Member], [M D Sal], [Rebate Contact], " sqlStatment = sqlStatment & "[Rebate Title], [Rebate Sal], [Replied], [Member Name], [S/Holder 2], [S/Holder], " sqlStatment = sqlStatment & "[ALPHA TYPE], [Member Type], sqlStatment = sqlStatment & ") "sqlStatment = sqlStatment & "VALUES "sqlStatment = sqlStatment & "( "sqlStatment = sqlStatment & "'" & C & "', '" & No & "', " For n = 1 to 15 if n <> 15 then sqlStatment = sqlStatment & "'" & FieldsArray(n) & "', " else sqlStatment = sqlStatment & "'" & FieldsArray(n) & "' " end if Next sqlStatment = sqlStatment & ") "'rESPONSE.WRITE(sqlStatment)'RESPONSE.ENDobjRs.OPEN sqlStatment, objConn,1,3'================================================= ========================================end sub

Any code or suggestions pls??

View 1 Replies View Related

Comparing 2 Tbles And Then Inserting New Only

Sep 17, 2005

I have two tables named datadistint and links
and i need to insert only some values in five fields of links from datadistint but before inputting values we need to ensure they are already not there in links.

Insert Into links (LinkTitle,LinkURL,LinkDescription,maincat,cat)
Select 1,3,2,4,5 From datadistint Where
1 Not in (Select LinkTitle From links) and 3 Not in (Select LinkURL From links)
and 2 Not in (Select LinkDescription From links)
and 4 Not in (Select maincat From links)
and 5 Not in (Select cat From links)

i ran the querry as above but it doesn't work what should i do or what's wrong with this querry,
because i need to compare all five fields and then insert only new values.

View 1 Replies View Related

Inserting The Records Into The Table

Oct 31, 2006

Hi!
Please, please, please help me!
I have created a form that should get Date, Day inputed by a user. Then it must place 8 the same records in the table.
Any help will be appreciated
Thanks in advance

View 2 Replies View Related

Inserting A New Field With A Fixed Value

Oct 19, 2004

How do I add a new field to an existing table so that the same value is automatically entered for all the records in that new field.

View 1 Replies View Related

Inserting An Object In A Table

Jul 28, 2005

I have been inserting thumbnail pictures into my table for the last six months with no problem. The field in my table displays "Microsoft Photo Editor 3.0 Photo." Now when I enter my thumbnail by inserting an object, the field displays the word "package" and the photo does not appear in the form where the pictures are displayed.
What would cause the word "package" to appear when I am inserting an object just like I have been doing for months?

View 2 Replies View Related

Inserting A New Row Between Existing Rows

May 15, 2007

To Whom It May Concern

I would like to know how can I insert a new row between an existing row in an Access Table

For example,

I want to insert a new row between line number 122 and 123. Do I need to get rid of the primary key or change it to Number. What I am doing now in order to have several topics group together on a report such as "Activities Topic" and a Date field for that topic. However, there are various topics under the Activities topic. Each new information that is being updated for this topic I have to reorder the number by the topic name in the Order field so that the date will be in chronoligal order in the report.

Is there a better way in do this?:confused:

View 1 Replies View Related

Missing Records When Inserting

Feb 5, 2008

Hi!

I hope this is the right section for posting this Q.

I use Access 2003 on WinXP pro as front-end & for back-end a MySql on a Linux server. I use MyODBC to connect to the back-end and all the tables are on the back-end. The workstation is connected to the server via VPN (so the server and the station are on different locations).

Quite often I get a problem that not all records are inserted into a table. E.g. I have like 5 - 15 records (up to 10 fields) in one table and I want to transfer/copy them to another:


strSql = "INSERT INTO tblDetailNakup " & _
"SELECT tblDetailNakupTemp.* " & _
"FROM tblDetailNakupTemp;"
docmd.runsql strSql


most of the time it works OK, but from time to time a couple of records are missing.

What could be the problem? Is there any way for somekind of a check, if all has been inserted otherwise the query is repeated?

TNX in advance,
Miha

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved