Queries :: Add Apostrophe To Mixed Data?
Jan 9, 2014
I am combining fields one that has apostrophe's and the other does not. exp "if this field is null use data from this field (which does not have an apostrophe) otherwise use current field (which has apostrophe)
"red"
blue
orange
"yellow"
How can I change that in the query without changing the previous query to
"red"
"blue"
"orange"
"yellow"
View Replies
ADVERTISEMENT
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 3, 2014
I have a query written in Visual Basic as follows
UA1 = Forms(ParName).Form.NOM
UA2 = Forms(ParName).Form.PRENOM
UA3 = Forms(ParName).Form.CARTE
Forms(ForName).Recordset.FindFirst "[NOM] = '" & UA1 & "'" & " And " & _
"[PRENOM] = '" & UA2 & "'" & " And " & _
"[CARTE] = '" & UAE & "'"
This query works and I can spot the record based on 3 fields and display it. Now I have discovered that we have a person who has an apostrophe in his name like O'Brian. The above code gives a syntax error in this case.
View 3 Replies
View Related
Jul 3, 2006
I have a problem with my database. When I'm writing in my data to the database via the forms, the data isn't in the correct order when I start the database up again. Its mixed up. I am using 6 tables and combining data. Why?
View 2 Replies
View Related
Jul 10, 2006
Is there away to change what is in the table field [surname] to the first letter being upper case and the remaining letters lower case.
Thanks
Sorry I found it. Just in a little rush.. Should have looked harder.
View 1 Replies
View Related
Nov 2, 2004
For example, if I'm coding an insert manually, if I need to insert a string from a textbox, I have to do something like this
mycn.execute "Insert into Test(FName,LName)values('" & me.text1 & "','" & me.text2 & "')
I have to put a ' at the end of each string values
Is there any way to bypass this? I mean I could put a validation code and each time I detect an apostrophe I handle it so that it doesn't create a problem
But I mean a simple way to bypass this
View 2 Replies
View Related
Apr 2, 2005
Hi, I may be dense, but I cannot find an answer to this question anywhere. If it has a simple and obvious answer, my apologies.
I have created an index with a field called "Surname" -- I need to know how to force Access to alphabetize the names disregarding the apostrophes (or a space) - for example, O'Brien. The way it works now, all the O' (s) go at the beginning of the Os (O'Brien, O'Malley, O'Neal, Oakley). I want it to go - Oakley, O'Brien, Oddfellow, O'Malley.
Is there a way to do this and still display the apostrope? I feel that I could set something for the field in the design view, but for the life of me I can't figure it out.
Thanks in advance for any help. :)
Jeri
View 1 Replies
View Related
Mar 24, 2008
Hi,
In my database if the user wants to change a record, I make them store the old record in another table. I am using the following code.
Private Sub cmdArchive_Click()
On Error GoTo ErrorHandler
Dim conn As ADODB.Connection
Dim i As Integer
Dim s As String
Dim sSQL As String
sSQL = "INSERT INTO tblNamesArchive ( txtGivenName, txtSurname )" _
& "VALUES ( '" & txtGivenName & "', '" & txtSurname & "');"
Debug.Print sSQL
Set conn = CurrentProject.Connection
conn.Execute sSQL
GoTo ThatsIt
ErrorHandler:
Select Case Err.Number
Case -2147217908 'command text not set
Case -2147217865 'cannot find table
Case 3021 'no records
Case Else
MsgBox "Problem with cmdArchive_Click()" & vbCrLf _
& "Error " & Err.Number & ": " & Err.Description
End Select
ThatsIt:
conn.Close
End Sub
I have no problems making the following code work except if there is an apostrophe " ' " in either the txtGivenName or txtSurname . For example O'Keefe it shows an error but not O"Keefe! How do I fix this?
Thanks
Raghu Prabhu
Melbourne.
View 2 Replies
View Related
Dec 14, 2007
sql = "SELECT Table1.* INTO Table1 IN '" & sExpFileName & "' FROM Table1"
CustDB.Execute sql
where the sExpFileName contains the path of The Target MS Access DB
The Query works fine. But recently I discovered that if my target File name contains apostrophe It gives error as Query Input must contain at least one table or query
Is there any way to solve this problem. Please suggest me some way
View 7 Replies
View Related
Apr 27, 2005
Hey, I have a problem with my application......when the user trying to insert string with apostrophe into txtDesc (text box), the code returns error...
Run-time error '3057'
the database inserts any records excellently, but not with the apostrophe....
here is my code:
Code:sql = "INSERT INTO M_Stock ([StockRef], [StockGroup], [Desc], [Location], [Category], [UOM], " & _ "[RQ], [Remark0], [Remark1], [Remark2]) " & _ "VALUES ('" & txtStockRef & "', '" & cmbSG & "', '" & txtDesc & "', '" & cmbLoc & "', " & _ "'" & cmbCat & "', '" & cmbUOM & "', '" & txtRQ & "', '" & txtRemark0 & "', " & _ "'" & txtRemark1 & "', '" & txtRemark2 & "');"Set dbs = CurrentDbdbs.Execute sql
Can someone help me with this problem? Thanks in advance
View 1 Replies
View Related
Oct 28, 2014
I have a Dell keyboard at work and I am trying to find the keycode to the apostrophe/quotation key. I want to disable this when pushed with the ctrl key. I've searched online but could not find anything that shows that specific key. I only see apostrophe keys or quotation keys but not the combination of both which is what I have.
View 4 Replies
View Related
Jul 20, 2006
hi,
i am getting an error in my coding for a INSERT statement becasue the text of the field contain an apostrophe.
that is my code is
DoCmd.RunSQL "INSERT INTO tbl_StartEndDates_OVERHEAD ( Last_Name)" _ & "VALUES ('" & Forms!OverheadEmployeeDates!lblLast_Name & "');"
but the text in Forms!OverheadEmployeeDates!lblLast_Name is "D'Amereo".
I know that this works for all other Last_Names without an apostrophe in it
does any one know the correct coding for this?
thansk
tuk
View 3 Replies
View Related
Mar 17, 2014
I have a button in one form that opens a different form and want it to show specific data to display. I choose this option in the command button wizard and set it up to have the name from my main form be the same name as my new form to be opened. Everything works perfectly until I choose a name that has an apostrophe in it. So if I choose the name "Ender's Game" it gives me the alert:
"Syntax error (missing operator) in query expression '[bookName]='Ender's Game".
I think I've found where the problem is, I just can't figure out how to fix it. When I looked at the onClick embedded macro it has the Where Condition as:
=="[bookName]= & "'" &[BookName] & "'"
Is there a way to get Access to accept that an apostrophe in the name is meant to be part of the string itself?
View 7 Replies
View Related
Feb 17, 2014
I use the follwing code to filter a report based on the listbox selection on a form. Below is the code I use, the problem it will error if the results have an apostrophe in the string.
Private Sub FilterDesc_Click()
Dim strWhere As String
Dim ctl As Control
Dim varItem As Variant
'make sure a selection has been made
If Me.ListCarrier.ItemsSelected.Count = 0 Then
MsgBox "Must select at least 1 Carrier"
[Code] ....
View 7 Replies
View Related
Dec 30, 2014
I would like to filter data from a table using a query (from an data input form). The objective is to output all results if input form field is empty and to output results higher or equal to the type in the field if field is not Null. The query code is as follows:
IIf(IsNull([Forms]![Form2]![MaxDiffInput]);[Maximum operational pressure (bar)];[Maximum operational pressure (bar)]>=[Forms]![Form2]![MaxDiffInput])
However, is not providing any result when the input field (MaxDiffInput) as a value.
View 5 Replies
View Related
Oct 1, 2013
Background I have a query (Q1) that retrives data from a table (Table 1). One of the fields in Table (F1) contains both text and numeric data (ie: 24 eggs). I want to separate these values in Q1.
Questions
How can i in Q1 retrive only numeric data from F1 and display that data i a field?
How can i in Q1 retrive only text from F1 and display that data i a field?
View 3 Replies
View Related
Apr 22, 2013
I have a query called "Stock" containing field like (Item, Description, product_qty)
Another is a table called "Sales" with fields like (Sales_ID, Item, Sales_description, sales_Qty, date_Of_Sale) Item field on sales is a foreign key.
Now what i want is how can i make when the user enters new record, in field "Sales_Qty" the data entered here to be less than product_Qty.
NB; this is because you can not sell more than what you have.
View 4 Replies
View Related
Sep 7, 2013
Attached you will find an example with the problem.
The query is only searching identical data between both tables.
I want it to show results from all users, with all the devices each user has.
What am I doing wrong with the query?
View 4 Replies
View Related
Sep 30, 2014
I am working on a report that has some special characteristics.
Let's say I have a list of groups of Vendors in a table, complete with VendorID. I have 3 other tables that use the VendorID: Complaints, Complements, and Terminations.
Each of these tables has a date that the Complaint, Complement, and Termination notice was received.
Every Fiscal Quarter, a report is pulled that looks back over the 4 preceding quarters to determine if a 5% threshold has been crossed by any of the vendor-groups in regards to the amount of Complaints they received.
The equation used for that is : (complaints/vendors_in_group)*100
It is imperative that the information has the current fiscal year and fiscal month (which I am tracking with functions from MS website), and I need to be able to store the information attached to the fiscal year and month.So when a user goes to the form and inputs the desired Fiscal Year and Fiscal Month, the database can display the 4 previous quarters of information...split into Q1, Q2, Q3, and Q4.
What I would like to have happen is to be able to have one table where the information is stored, quarterly, so that it can be retrieved for the report.
Questions:
1. Is it possible to have one line, per VendorID, that has the total number of Complements, Complaints, and Terminations, as well as the threshold percent stored in a table? Right now, I am getting LOTS of duplicates and blank lines when I try to put them all together. It has the right data, but takes about 10 rows per VendorID.
2. It is very important that the total number of Vendors in a group be captured on that quarterly report, so maintaining that number, in the same table, is essential and must be tied to the VendorID.
3. I have looked at Union Queries and Crosstabs, but I just dont know enough about them to make it work.
View 4 Replies
View Related
Apr 14, 2014
I have a table (tbl1) contains sample records in Basecode column like S2378797 , R1165778 , W1165778 , N1165778
Description EID Basecode
----------- ---- ---------
ssdad 1001 S2378797
gfd 1002 S1164478
gfdsffsdf 1003 R1165778
ssdad 1004 M0007867
gfd 1005 N7765111
[code]....
And retrieving all **Basecode** if column data length >6 and with numbers '96', '78','54','15' by this query
Code:
SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1
WHERE (((Len([Basecode]))>6)AND ((Left([Basecode],2))='15')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='54')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='78')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='96'));
How do i get other data which won't retrieve based on above queries, other than data mentioned on these queries like this
Description EID Basecode
----------- ---- ---------
ssdad 1001 2378797
gfd 1002 1164478
ddd 1004 1040
d88jg 1004 14C676
fsa 6565 158
fdh 1004 2Khlm
ggdg 2009 967
Third query not working
Code:
SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1
WHERE (IsNumeric(Left(Base,1)) AND Left(Base,1) Not In ("W","N"))
AND NOT (((Len([Basecode]))>6)AND ((Left([Basecode],2))='15')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='54')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='78')) OR
(((Len([Basecode]))>6) AND ((Left([Basecode],2))='96'));
View 2 Replies
View Related
Oct 15, 2014
How Mark disappear field data based on field data last.
Example:I have a field type in the name and on behalf of another field No.
In the case of the Type-B data is deleted Number field, which is before the character.
View 1 Replies
View Related
Jul 6, 2005
I read a lot for work and the material is from many different disciplines. To keep track of all this information, I set up a simple db to keep track of all my references and have fields containing various bits of information for each record. In the beginning, I assigned one keyword to each reference as a means of retrieving articles on related subjects. Over time it has grown to three keywords per record although some of the keyword fields are null. All keywords are in a single, separate table and I add a keyword to a record from a pick-list. When I increased the number of keyword fields to three in tblCatalog, I just added more links to tblKeyword. Now, I am having a tough time trying to query tblCatalog. Obviously, my basic db organization is not right so I am looking for suggestions on how to straighten out this mess. Here is what I would like to do:
* During data entry, select form one to three keywords for each record
* During data retrieval, concatenate all the keywords (one, two or three) and
list the resulting text in a single control on a form.
This seems like it ought to be easy but not today. There must be something fundamental that I do not understand.
View 2 Replies
View Related
Jun 14, 2006
ok heres the thing, im not brilliant at dababses but ive created one for my work. i want to create a query to summarise the information
the database is to log customer queries and there is a field for the department responsible e.g warehouse, sales etc. this is a list box by the way
i want to summaries the date for example
between 30/5/06 to 14/6/06
warehouse had 12 queries that were responsible for them.
i can so the date part of it but i dont know how to do that.
any help will be much appriciated!
View 9 Replies
View Related
Oct 12, 2006
Hello there,
I have a query that calculates price x quantity. That bit is easy. However from time to time my suppliers will issue a detailed quotation (ie lots of items, lots of prices and lots of quantities), then one week later issues the exact same quotation but with price changes and/or quantity changes. I need to show to my client the progression of the costs, so the calculated (price x quantity) column has a cost at (date) heading that needs to be updated regularly. I am looking for a way in my query to lock down the data in in the calculated column at each date, so that when I get a revised quotation, I don't have to re-enter all the items, I just change either the price or quantity. Is there a way to do it ? This is about as clear as mud, but I hope someone out there understands. Thanks for your help.
View 3 Replies
View Related
Jan 31, 2005
Each month I get 20 new tables to query data from. The field layout for my query is the same each time, with about 40 fields in total. Because this is the same query each time (and only the data in each table changes), how can I best set this up. I.E. each time I run the query, I have to go back in to the design view and select the new table for each field (in this case, update all 40 fields with the new table name). Surely there is a quicker way to do this.
Thanks,
View 3 Replies
View Related
Apr 11, 2008
Hi all, let me start by saying that i am not that experienced with access but find it really enjoyable and want to learn more. i dont always understand or use the right "jargon" but here goes. i have a db with 3 main tables, each table has the same layout and info inputed into it (ie, name, address, product, ref no. etc.). from each table i can print a sales reciept with all of the relevent info on it. i also print a sheet (report) with the customer names & addresses on it, used as the postal labels. i currently print 3 postal label sheets, 1 for each table. what i would like to do is print just the one report but taking the name & address data from all 3 tables. would really, really, really, really appreciate any help on this as it is beginning to frustrate me, and waste a lot of paper !!.
i'm using access from microsoft office professional plus 2007.
many thanks
dbwannabe
View 4 Replies
View Related