Select Only First Two Characters From Table
Dec 5, 2005I have a table which contains a nine digit number. How do I write a query to limit the restults to just the first two digits of that nine digit number?
Thanks
I have a table which contains a nine digit number. How do I write a query to limit the restults to just the first two digits of that nine digit number?
Thanks
Hi,
I am trying to use a query to select the first two characters from a field I have created in a form. I would then like to use these 2 letters to filter out results in the query.
For example:
I have a number of sections in a document (1a - TAKE OFF, 1b - LANDING, 1c - STATIC etc.) which include associative chapters (1a.Contents, 1a.Introduction etc.).
From a combo box I select the section (i.e. 1a - TAKE OFF), I then want to filter out all the chapters in the associative section (i.e. 1a.Contents, 1a.Introduction etc) by using the first two characters of this combo box in the query.....
I hope this makes sense!!!
Cheers
I have the command to select first 30 characters in a simple select query.
View 3 Replies View RelatedI have to import a field from Excell that contains more than 50 characters in the field.
I need the line to stop at the last complete word prior to 50 characters and start the next record in that field automaticly and continue to fill and wrap at the last complete word prior to 50 characters.
Would it be better to do this in another Office 2K program?
I have several thousand lines to type if this can't be automated. What a drag.
TIA
M :confused:
Hi Folks,
I have a table called tblSchemeCodes with the following field names:
Field Name Data Type Field Size Required Indexed
strCompany Text 1 Yes No
strSchemeCode Text 3 Yes Yes(No Duplicates)
strSchemeName Text 100 Yes No
strOrigNo Text 9 Yes No
strCategory Text 9 Yes No
dtmDateAdded Date/Time No No
Here is an example of some of the scheme codes I have:
HG
HGA
HGB
HGD
HGF
HGG
HGJ
HGP etc etc
however when I try to add HGE, it won't allow it, even though it doesn't exist within the table, it keeps changing it from HGE to HE, and HE already exists, so a can't add messgage pops up, which is should, because duplicates are not permiited.
I've tried turning off all of the required aspects and changed the "Yes (no Duplicates)" to "No", and the problem persists!!
Has anyone any idea why access would behave in this way and how I might resolve it.
Any assistance would be appreciated
John
I have the following code:
#: Mid([Emergency-Approver],InStr([Emergency-Approver],"EBF-"),5)
Here is my problem. I need the number that is at the end of EBF, sometimes there will be a dash some times a space, i know that I can use RIGHT to remove the first 4 characters, however I do not know where to place that in the above code.
My second issue is once I have the number only showing in the field I want to link that answer to a table that has a description of what that number represents.
The table name is Approval_Code. I want to have it do a VLookup type of function however that is not available in access. So I need to know how to get that result in a new field.
Any help would so be appreciated
Thanks
Rue
How to search an Access table for unwanted <cr> characters
Occasionally a stray carriage return <cr> Ascii 013 character finds its way into an Access table. These destroy the database when the table is processed by an outside utility for data cleansing.
To prevent this from happening, we have been told to clean the table before submitting it, i.e. remove all of the following:
carriage return, comma, double quotes, equals, greater than, smaller than
Is there any utility available which will remove all these characters when being run only once? (i.e. not find/replace which has to be started separately for each of these characters)
How do I search for a <cr>, even with find/replace?
Thanks.
Adrian
if it is possible to store text in a table that includes subscript / superscript characters. As an example; need to indicate the units of measurement for some data and therefore need to be able to pull data from the table such as the following: kg/m2, m/s2 etc. In both these case i need the 2 character to be superscript.
I'm trying to make this an automated process so pulling it directly from the database.o a method of storing the data as a text string would be ideal.Otherwise i imagine a rather difficult VBA function will be involved
I have a data base,one of the field contain Data like "ZZZ-DEFS#UUH1234567".
There should always be 19 characters in this field including #.I want to design a query which can sort out entries less than and more than 19 characters, so that wrong entries can be corrected .
My database has several tables (and queries) that have fields that contain people's names. Some names, like O'Neil, contain apostrophes. Other fields contain couple names, like Tom & Laura Jones. Both the ' and the & prevent queries, forms, and reports from working correctly.
View 3 Replies View RelatedI have a current file with GBP 12.00. I wish to remove the GBP in a make table query when ran to print off.
View 2 Replies View RelatedHi
I have a small database with 4 tables that I am using for the current problem.
The tables are call, parents, mailman, orders.
Call and parents are related by the call ID (a primary key in the Call table.).
Mailman and orders are related by a Unique Id (a primary key in the mailman table.).
Forms involved are frmmain and frmsub.
Frmmain contains the call table information in the main form and parents information in the subform.
When a user enters a call with call ID and enters the operator name and parents information in the sub form,
When a user clicks the OK button on the main form, necessary changes should take place
if they enter the case type in the sub form part of parent information as ‘missing information’ or ‘missing link’ then the parent information with fields first name, lastname, case type, operator information should be inserted into mailman table in appropriate fields.
Simultaneously a record should be inserted into orders( after the record is first inserted into mailman, since both tables are linked with unique id) with the following information.
Orderid being autonumber.
Uniqueid from the mailman table.
Orderdate system date.
Ordertype should be “Mailman”
I have a basic database design, well I think so anyway. It only has two tables:
1. tblClientInfo
2. tblNotes
Basically each client has multiple notes/comments that can be linked to its record, hence the tblNotes table. The two tables have a one-to-many relationship, being that each customer can have many notes.
I then have two forms:
1. Claims Loss Form
2. tblNotes_DatasheetSub1
So I can enter multiple notes for each customer. The problem I am having is with the report output. It wants to print every note (record) that is linked to the customer. I just need it to print the most recent note for each customer (It would save a lot of wasted paper).
Example of a print out of what it is doing:
John Doe - 123 Easy St - Notes 1 (Most Recent Note)
John Doe - 123 Easy St - Notes 2 (Previous Note)
John Doe - 123 Easy St - Notes 3 (and so on...)
It is printing duplicates of the same customer by adding the additional notes for that same customer on a new line.
How can I tell it to only print the customer one time in the report, and most importantly, to only use the most recent note that is linked to the customer?
I tried using DMax("NoteDate","tblNotes"), but this only returns one customer with one note. I need it to do that for each and all customers.
I have successfully ran a subquery (two queries with one linked to another) by following detailed instructions from this page I found: [URL] .... It works, but the problem is it only shows the latest date for each note, not the actual contents of the note. I feel so close with this option, but so far at the same time.
The TOP n records per group looks promising that I found here: [URL] ...., but I honestly don't know how to implement it correctly in my SQL. I am very much still learning Access and apparently have stumbled into something that is much more complicated than I had originally imagined. I just assumed I could filter the duplicates out, or tell access to print the last or most recent note record for each customer.
Hi Guys!
Need help in putting up SQL string.
I have two tables. The first one contains customer information. Primary key is custno. The second one contains customer logins, primary key is also custno.
What I want to do is to view customer information that does not have customer logins.
Is it possible to do in MS Access 2003?
Regards,
Aga
Hello,
I am trying to familiarise myself with MS Access and have the following problem:
Lets say I have a Table A with two columns as follows:
Name Total
Tom 1000
Mary 200
Brigid 150
Niamh 75
My question is how can I - using SQL only - select the nth, ie 3rd or 4th row?
I have spent some time on this and it irks me becasue it is probably very simple.
Any help or advice will be gratefully received.
Best Regards,
Tony
I have two tables [Reviews] and [Results].
When a Review has a Status = 'Not Accepted' then there should be one or more records in [Results] that indicate what the result of the review was.
I want to structure a query to perform a data integrity check to select any Review ID that satisfies the following criteria:
- The Review Status = 'Not Accepted'
- There are zero records in [Results] for that ReviewID
I can't figure out how to do it.
Here is an example of the tables where all record are OK...
[Reviews]
ID...Status
1....Accepted
2....Not Accepted
3....Accepted
4....Not Accepted
5....Not Accepted
6....Accepted
[Results]
ReviewID....ResultID
2................5
2................6
4................3
5................3
5................7
Here is how [Results] would look if there is a data integrity problem, where the results for Review 5 are missing....
[Results]
ReviewID....ResultID
2................5
2................6
4................3
So I want to structure a query that would return the following...
ReviewID
5
Because this is a Review with Status = 'Not Accepted' but there is no corresponding record(s) in [Results].
I guess in plain English it would be like this...
SELECT ReviewID
FROM [Reviews]
WHERE (ReviewID is in [Reviews]) AND (ReviewID is NOT in [Results])
Can this be done in a single SQL query?
Query
SELECT s.contracttypename, sum(s.sumrtr*v.pct) AS [predicted $]
FROM sumrtr AS s, varcurve1 AS v
WHERE s.mdiff=v.monthodr and s.contracttypename=v.contracttypename
GROUP BY s.contracttypename;
I have varcurve1 varcurve2 varcurve3....
I want to provide a mean (interface?) for user to choose varcurve1 varcurve2 varcurve3 to run above query.
for eample if user choose varcurve1
the query will run
SELECT s.contracttypename, sum(s.sumrtr*v.pct) AS [predicted $]
FROM sumrtr AS s, varcurve1 AS v
WHERE s.mdiff=v.monthodr and s.contracttypename=v.contracttypename
GROUP BY s.contracttypename;
if user choose varcurve2
the query will run
SELECT s.contracttypename, sum(s.sumrtr*v.pct) AS [predicted $]
FROM sumrtr AS s, varcurve2 AS v
WHERE s.mdiff=v.monthodr and s.contracttypename=v.contracttypename
GROUP BY s.contracttypename;
is there a way to do that?
Thanks
Hi in the attached database there is a form called "with table select".
I want to be able to select any one of the three tables i have in the top combo box. When this is done the bottom 2 combo boxes will display the relevant data if needed (look at the other form "myform" to see the fields that are requseted).
Is this possible? :confused:
Thanks
Is there any way to get the last 4 rows which have been entered into the table?
Thank You.
Hey All!!
This is what I wanna get done. I have a big table I am querying into and extracting data and populating it into the new tables that I have constructed.
For eg:
SELECT dbo_analyst.anls_id, [fst_name] & [lst_name] AS Analyst
FROM dbo_analyst;
This query selects the name and the ID of the Analyst out of the big table. I want to store these values in the Analyst table that I have made. Do i need to combine an Insert or an update query with the select query to simultaneously put the values in the Analyst table.
Please help me on how to go about with this.
Thanks
Mo
I'm trying to use code to relink the the table but that is not the only table that is linked in the DB. The other linked tables are in other databases so I want to select specific tables to relink as the others may not need it. I alway will want to select the path.
here is an example of the code I'm using I got it from one of the other users here.
Hello all,
Is there anyway to create a table from a query like you can in oracle?
i.e.
Create Table [B_match] AS
SELECT *
FROM [B_All]
Take care
Hello! I am building a report that tracks excessive call-in's for my hospital's employees. Data is entered into a form which then is stored in the table (duh!) "Call-In's." I have a query that lists all those who have more than 5 call-in's.
Here is the problem: In order to get the sum of callin's per person, I did a totals field in my original query and counted on Name. But now I needed to know the sum of each person's, and so I had to do a cross-tab query that included the name, department, the count (from the first query) and then I summed on the count field. What a mess, right? Also, I added a field for If >5, Yes, No.
I based my Excessive call-in's report on the final (above) query. Like this:
Call In's table
Name, Department, Date of Call in, Call in type
Call-in's query
Name, Department, Date of Call in, Call in type, Count of Name
Call-in's crosstab
Rows: Name (GROUP BY), Department (GROUP BY)
Columns: Count (SUM) and total of Count (SUM)
Excessive Call-In's query
Name, Total of count, iif >5, Yes, No
There are already 54 records in the table, one of which has excessive call in's (more than 5).
Is there a way to run a report that not only lists the person's name and number of call in's but also the date of each one and the call in type? Both of these are fields in the call-in's table.
When I try to combine my Call-In's query with my Excessive Call In's query I get the matrix. Example: I get the same record for however many callin's they have. Thank for your help. I'm so sorry this is complicated. I've got to be doing something wrong, or at least inefficiently. Does any of this make sense? Thanks again.
Kelly (the clueless, but I'm trying)
I have a databse which uses a query and a form to filter records from 1 table into a report. It works well, however the way in which it works currently means i would need around 15 forms as there are (going to be) around 15 tables.
What I would like to do is add a combo box at the very top of the form to select the source table for the other combo boxes on the form (hope this makes sense!!).
This link is a test version of the database (Access 2000):
I am trying to run a sql statement in vba in which it selects all the records in a table related to a order Id number. I then want it loop through all the records and check for a check box which is selected. if its selected then "A" variable becomes "1" and i will then run a if statement saying if variable is 1 then run this code else run code b.
The problem I am having is that if there are 4 records the code checks through all of the 4 records and keeps changing the variable so
record 1 variable is 0
record 2 var is 0
" " " 1
" " " is 0
so although the records for a given order number does have a checked box the code wont recognise that.
What I can do or what code I can add my minds gone all blank on this.
I had 3 drop down filters that worked when the word being filtered was written in the table. I have since then linked them to new tables to be more database-y. The problem I have found (a couple weeks later too) is that my drop downs broke.
It makes sense why, they are now 1,2,3,4 instead of words but how do I make this work now that it isn't in the current table?
Code:
Private Sub cboMDS_AfterUpdate()
Dim myPlane As String
If Me.cboMDS = 0 Then
myPlane = "Select * from Baseline"
[Code] ....