Concatenating Fields Based On Criteria?

Sep 20, 2006

I have a query that is set up to join two name fields...for example:

[ELIGVENDORS.LSTNAM] & [ELIGVENDORS.FSTNAM]

The issue is that this is perfect for names that are entered in the table like this:

Lstnam: ABC HOSP Fstnam: ITAL

They are entered like that for groups, but when individual doctors are entered, the data entry folks are entering them like this:

Lstnam: SMITH Fstnam: BOB Titlcd: MD

So when I join them the first displays correctly as ABC HOSPITAL, the second displays as SMITHBOBMD and I have to manually go in and add a comma.

Is there a way to do an if/then statement or something to tell the query to display results If the titlecd is NOT NULL, display as [ELIGVENDORS.FSTNAM] & [ELIGVENDORS.LSTNAM]&", "&[ELIGVENDORS.TITLCD], else display as [ELIGVENDORS.LSTNAM] & [ELIGVENDORS.FSTNAM]

I'm sure there is, I am new to IF/THEN statments though and was hoping to get some help setting it up.

Thanks in advance and I hope my description is clear enough.

Han

View Replies


ADVERTISEMENT

Auto Rearrange Fields Or Hide Fields In DataSheet Based On Criteria

May 17, 2007

I have main form and that has one sub-form , this Main form governs/determines the data in the sub form.

This Sub form ( DataSheet Mode) has approximately 130 columns and based on the Main form criteria only ~ 20 columns has to be filled.

What I want to do is based on the main forms criteria I want to show only the columns that are applicable to main form criteria.

If I use Columnar or Tabular single form for the Sub Form I am able to hide the fields that are not required BUT IT LEAVES A SPACE/GAP on form ( for the hidden fields that are not required)

Private Sub Form_Load()
If Forms!frmShowPIforActiveAndCanAddNewPI!FrmSubFrmFi lterProductInformationPerFMT!CASETIF = True Then

Me.CASETIF.Visible = True
Else
Me.CASETIF.Visible = False
End If
End Sub


And If I use DataSheet and hide ( visible = no) a particular filed it still shows up in Sub Form

Is there a way to Auto-Re Arrange all the fields in the sub form so that the hidden ( visible = no) fields no not leave gap


Or is there a way by VBA program to select fields ( Columns) from a table to be displayed on a sub form based on a criteria

Thanks
Rahul

View 1 Replies View Related

Help With Concatenating Fields

Jun 11, 2006

G'day,

I want to produce some UPCa bar codes which require 11 digits of TEXT for the barcode function to work.

I want the bar code to be made up of several fields
Make 3 Chars (Text) (eg 021)
Model 3 Chars (Text) (eg 103)
Serial_Number 5 Characters (Numeric) (eg 00025)
(I need to keep the Serial_Number field numeric so that it increments in modulo 10 format (ie get Numeric only results))

So i need to produce a field that looks like this 02110300025 after the 3 fields are concatenated

However I am getting 02110325

I'm sure that the answer is simple but I seem to be having a mental block. Does anyone have any ideas? Your help will be very appreciated.

View 5 Replies View Related

Query Two Fields Based On One Criteria

Aug 21, 2005

Hi all,

I am endeavouring to filter a form based on the position of an individual.
I would like the users to be able to select their position and then any record where there is a match in the "Primary Responsibility" field or the "Secondary Responsibility " field will be displayed.

I have an underlying query that is populated by a combo box on an unbound form.

This has worked when generating reports for individuals but I cannot get the required result when using the form.

Thanking anyone in advance who can assist me with this.

Regards,

Rod

View 2 Replies View Related

Query Based On Criteria In Two Fields?

Sep 7, 2007

Hi All

I want to create a query which is based on two fields.

One field is a date query i.e >=Date()-7 OR >=Date+7

The Other is a Combo box where the criteria is No

My problem is that access is currently running this as two individual queries.

Is it possible to make this query return data only when both fields are matching?

Or do I have to run this as a parameter query?

Thanks!!

View 2 Replies View Related

Concatenating 2 Table Fields To Form Another

Dec 31, 2004

Hi all,

Ive got a table called tblClientCar, this is its structure:

ClientCarID
ClientID
CarID

I want to use an append query to concatenate ClientID and CarID together and putting the concatenated value into ClientCarID. How would i do this?

Ive tried using a form a two combos so when i select the clientID from the 1st combo and then the CarID from the 2nd combo, then run the append query to write the concatenated value into ClientCarID of the table. But it says writing 0 rows to table and the ClientCarID isnt concatenated when i check the table. This is the query sql syntax i was using:

INSERT INTO tblClientCar ( ClientCarID, ClientID, CarID )
SELECT tblClientCar.ClientCarID, tblClientCar.ClientID, tblClientCar.CarID
FROM tblClientCar
WHERE (((tblClientCar.ClientCarID)=[Forms]![frmClientCar].[Combo6] & "" & [Forms]![frmClientCar].[Combo8]));

I also tried another way. The 2 combos add the selected values into ClientID and CarID in the table tblCar. So i made the append query slightly different to concatenate ClientID and CarID to form ClientCarID. This is my query sql syntax:

INSERT INTO tblClientCar ( ClientCarID, ClientID, CarID )
SELECT tblClientCar.ClientCarID, tblClientCar.ClientID, tblClientCar.CarID
FROM tblClientCar
WHERE (((tblClientCar.ClientCarID)=[ClientID] & "" & [CarID]));

I get the same result as the 1st query. What am i doing wrong?
Is there another way of doing what im trying to do? Whats the correct sql syntax for doing this?

Thanks
Jim

View 8 Replies View Related

Concatenating Text Fields From Different Records

Jul 13, 2005

We use two different systems in our office that have notebook facilities. One of them stores only a limited number of characters in the note field per record and as such, some notes actually span several records.
The other system stores the whole note in one record.
We want to transfer all the notes from the first system (1 note over several records) to the second system (1 whole note in 1 record).
I have a table with the notes from the first sytem which looks something like
Note1 - Line1 - Text
Note1 - Line2 - Text
Note2 - Line1 - Text
Note3 - Line1 - Text
Note3 - Line2 - Text
Note3 - Line3 - Text

What I want to do is, for each note, combine the separate lines into one record.
I have been able to do this in Excel with some formulas (see attachment) but am wondering if it is possible to do this in an Access Query (i.e. GroupBy the note number and have a calculated field combining the individual lines of the note, or something similar)?

View 8 Replies View Related

Concatenating Fields Ignoring Blanks

Jun 4, 2006

In a query, I'm using concatenation to join multiple address fields (organisation, building number, street address, etc) into one field. I'm also inserting line breaks to create a formatted address and then creating a form on the query so the formatted address appears in a text box and can be copied and pasted straight into my label-writer software to print address labels.

This is the concatenation code I'm using:

Expr1: [Organisation] & Chr(13) & Chr(10) & [Building Number] & Chr(13) & Chr(10) etc.

However, one problem with which I am now presented is where a field is blank. E.g. if one of my contacts is retired, then they don't have an organisation listed in the "Organisation" field. This means that a blank line is left between their name and the rest of the address.

When running a mailmerge there is the option of skipping blank fields so that a blank line is not inserted in such cases.

How can I achieve this within the above code?

Gary

View 6 Replies View Related

Reports :: Concatenating 5 Fields To One On Report

Apr 1, 2015

I have five reason fields in my table and I would like combine them into one field on my report, with line breaks between so each reason starts on it's on line. Also if there is a blank record, I would like the report not to display a blank line. I have found ways to do this online for 2 records but I need this for 5.

Also when I do manage to get the lines all to show in the report there are 3 paragraph returns between them - making the reason display of the report 15 lines tall, not just 5. The code I have so far, which displays each of the reasons but spaced as described is:

=[REASON1] & " " & [REASON2] & " " & [REASON3] & " " & [REASON4] & " " & [REASON5]

View 5 Replies View Related

Concatenating Fields Defined As QryQueryName.ColumnName?

Jun 28, 2005

Hi

I did a search to no avail...

I am trying to concatenate Address fields into one text box. The Control Source pull-down menu gives me the Field Names listed as QueryName.ColumnName.

I know that if they listed the fields as just ColumnName, you'd simply go:
ColumnName & " " & ColumnName2...

But the way these columns are defined, I cant find the correct syntax.

Is there a way to do this without changing all my queries??

Thanks again! :)

Mike

View 8 Replies View Related

Tables :: Limit Data Input Based On Another Fields Criteria?

Dec 22, 2014

I have two tables linked by ID (Table1,Table2)

The Table1 holds data that is a request for a task.

ID, Request, Task_tms (the number of times the task is required to be done)

1, Make a cup of coffee,15

Table2 is my allocation of people to the tasks.

ID, Person, Task_done (the number of times this person has done the task)

1,Sally,10
1,Eddie,5

What I want to do is to limit the amounts of allocation in some way (ie in this case if I have already put 10 for Sally then I would be unable to put anymore than 5 when entering the amount for Eddie.

Additionally if I were to allocate all 15 to Sally then no additional people would be able to be allocated to this task (ID 1)

The two table are in datasheet format linked on a form.

View 1 Replies View Related

Reports :: Conditional Formatting On Multiple Fields Based On Two Criteria

Sep 24, 2014

I have a report which I would like to apply conditional formatting on multiple fields. I would like the conditional formatting to be based on two types of criteria

First criteria would be contracts that start with the year 2014. I used the following expression which worked - InStr(1,[ContractNr],"2014" AND [DirectorInCharge]= "Joseph Steinbok" or "Adam Godson")

To this expression I would also like to highlight fields which contracts start with 2014 AND have a particular Director assigned to it. For this I used the following expression - And [DirectorInCharge]="Name"

On their own, both expressions are working but I want to combine them. How do I do this? I've tried the following - InStr(1,[ContractNr],"2014" AND [DirectorInCharge]= "Name") but then nothing is highlighted. I also tried InStr(1,[ContractNr],"2014") AND [DirectorInCharge]= "Name" - in this instance EVERY record was highlighted.

View 4 Replies View Related

Queries :: Query To Run Before Report Based On Criteria Based From Two Combo Boxes On Form

Mar 20, 2013

I have a report that gets its data from a query. I need the query to run before the report based on criteria based from two combo boxes on a form.

View 3 Replies View Related

Beginners Question - Auto Update Fields Based On Fields In Another Table

Nov 26, 2007

I don't have any database experience whatsoever so please go easy.
I'm guessing this kind of this is extremely simple for all of you.

I'm constructing a database of network resources and devices and I'd like to automatically update the values in one field based on the values of a field in another table.

The first table is called "IP" and the fields are called "Address", "IP Type" and "Device".
The second table is called "Devices" and contains the fields "Name", "Description", "Asset Number" and "IP".

Here's an example of the tables: (ignore the "code" tag. i've only used it to align my columns properly)

DEVICES:
NameDescriptionAssetIP
XserveFile Server107203.30.144.75
ProliantXDHCP119203.30.144.15



IP:
AddressIP TypeDevice
203.30.144.75Static
203.30.144.15Static


What I want is for the Device field in the IP table to automatically update it's values based on the values found in the Devices table. In this case, the values that should appear in the Device field in the IP table are "Xserve" and "ProliantX".

I've searched through but haven't found a complete solution, just little pieces which I'm too inexperienced to put together myself.

thank you
-Tim

View 2 Replies View Related

Forms :: Total Query - Count Of Fields Based On Data In Other Fields

Jun 28, 2015

I have a query that creates counts of fields based on the data in other fields, basically it tells me that in a table there are two entries with value ABC????? and three of DEF????? , the query works perfectly.

When I create a form to display this data and base the form on the Query I keep getting a message box asking for the ID (key field) from the base table.

If I type * in the box (to denote all values) and press enter I get the results expected.

View 4 Replies View Related

Tables :: Set Up Validation Of Fields Unit And Size Based On Another Fields Data?

Nov 18, 2013

Basically in my order details table i have the following fields

Product
Unit
Size

At the moment i have the Product field with a dropdown that gives me all the products from my ProductT. But once i choose the correct product in the unit field it gives me all the possibilities of every product not just the units associated with that product. ie

ProductT
Grasshopper Box1000 Adult
Grasshopper Box1000 Subadult
Worm 10pz Big

When I select the grasshopper product and move on to the unit field i also get "10pz" option but this is not a product available.

How do i set up validation of the fields Unit and size based on another fields data?

View 4 Replies View Related

Adding Fields Based On Values In Other Fields

Jun 6, 2007

Hi,

I am creating a small database to house results of certain tests. Is there a function in access that allows me to add fields if a result is out of the specification required. In other words I still need to record the out of spec results but I also need more fields to appear for the next lot of results to be entered, for example.

When cooking a batch of product I need to test the pH at the 30 minute mark if the pH is too low I will continue cooking the product for another 30 minutes and then test the product again. The cook time is not a constant so I never know how many samples are required, therefore I don't know how many fields i would need in advanced.

View 3 Replies View Related

Concatenating In Reports

Oct 11, 2005

I have a firstname field, and a surname field.

On a report I have a textbox that is bound to =[firstname] & " " & [surname]

This gives me an error. I have even tried single quotes, but no luck.

Please advise

Thank you in advance

View 2 Replies View Related

Concatenating Problem

May 28, 2007

Hi All:

, I have two fields to concatenate.

SKU = ps1-
Supp_sku = 98756

I want to have it like ps1-98756.

I have used the following query to test the result -

select sku & “ “ & supp_sku as [my_sku] from inventory_master;

The result is
My_sku = 198756

I do not get ps1-98756.

Could you please help?


Thanks - Prabir

View 9 Replies View Related

Concatenating Instead Of Adding

Jan 9, 2005

I am trying to create a basic query that adds four numbers, but when I try '[Mark1]+[Mark2]+[Mark3]+[Mark4]' it concatenates it instead of adding.
e.g. I have '58+96+13+45' and I get '58961345' instead of 212.

View 1 Replies View Related

Query Based On 2 Out Of 4 Criteria?

Aug 18, 2005

I have table with filed with jobs that our IT’s have done for that day, the table is updated daily, based on my table I have created my query, I have set some criteria for some fields though, as follow:

Month = [Forms]![DailyWorkForm]![commonth]
Year = [Forms]![DailyWorkForm]![comyear]
ITName = [Forms]![DailyWorkForm]![comit]
Day = [Forms]![DailyWorkForm]![comday]

on my form I have commonth, comyear, comit, comday and a command button that will open a report based on the query which will be based on my 4 combo boxes on my form, ok I hope I didn’t make you all really confused, this is the question what if the user inputs on 2 combo only, meaning that if month = may and year = 2005 and left ITname and day empty, I still want the query to run, how can I do that?

Thanks a lot.

View 8 Replies View Related

Criteria Based On The Value In Another Field

Feb 15, 2006

Hey guys, apologies in advance for a question which you may have answered many times, I have searched the net, my textbook and these forums but to no avail.

I have a table, 'tblStock'.

I have two fields within this table, 'Stock Level' and 'Minimum Stock'.

I want to run a query on this table, finding all records where the value in 'Stock Level' is LOWER than the value in 'Minimum Stock'.

How would I go about setting up this query? What criteria would I type? I have tried typing <"Minimum Stock" in the criteria for 'Stock Level' but it didn't work.

Thanks in advance... this will be a big help. :)

View 7 Replies View Related

Randomizing Based On Criteria

Dec 17, 2013

I have created a db where I need to run a report based on randomizing. Basically there is a table ORDERS that is updated daily with orders from clients.

Table structure is:
ORDER ID (autonumber).
CLIENT.
ORDER.
Quantity,
Date.

Sampling criteria is:
if number of Orders is from:
1-10 show me 90% of them
11-20 show me 85 % of them
21-100 show me 51% of them etc

I did found this code for the randomizing with autonumber:

Private Sub cmdSelect_Click()
Dim SQL As String
Dim sWhere As String
Dim iCount As Integer
Dim i As Integer
Dim j As Integer
Dim iSelectHowMany As Integer

[Code] ...

How to integrate into this code my sampling?

View 8 Replies View Related

List Box Based On Criteria In Same Row

May 2, 2014

I have a table where the columns are team1, team2 and winner. Team1 and team2 are comboboxes that show all the teams in Team table. After I pick the team1 and team2 in a row I want to make a listbox that shows only those two teams as options for the winner.

View 3 Replies View Related

Criteria Based On Value In Another Field

Apr 3, 2012

I have a query in Access with the following fields (grouped):

"Name" "Facility" "Number of Visits"

I want to limit the query to only pull those names that have at least one visit to a specific facility (let's say facility "A"), but I also need to see all of the other facilities that those who visited Facility A visited. So in this case "= "A"" in the criteria section of the Facility field wouldn't work. I think I need to plug something in the criteria section under the Name field, but I am not sure what.

View 1 Replies View Related

Concatenating Data In A Table

Sep 15, 2005

Hi folks,

New person to the forums here. I've had a scroll through the FAQs and can't see an answer to a problem I need to solve. I wonder if there's anyone could offer some help?

My db has three tables: table_a, table_b and table_c. Each table has the following fields:

table_a
a_id (PK)
a

table_b
b_id (PK)
b

table_c
c_id (PK)
a_id (FK (many to one))
b_id (FK (many to one))
c

I would like field c in table c to be a concatenation [table_a].[a]+"-"+[table_b].[b]. I'd like this field to automatically generate and be constrained as unique. Creation of value c in table_c should be by selection of value a & then value b in a form based on table_c.

Can anyone advise me how I do this?

By the way - editing to add this - I am using MS Access 2000 & can't upgrade to a later version.

View 8 Replies View Related







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