access 2010 use only part of text field in calculated field expression - ms-access-2010

Creating a database for an online booking system. Relatively new to access but have worked out how to automatically combine two fields in a table to fill another field. Here is what I have:
There are currently three fields in question, these are:
firstName
Surname
hostName
hostName is the calculated field and the expression is as follows:
[firstName] & " " & [Surname]
So if the value of firstName is "Dave" and the value of Surname is "Smith", the current result in hostName is "Dave Smith". This is fine but I want it to only combine the value of firstName and the first letter of Surname to produce something like "Dave S".
I have looked around for a way to do this and have tried some things that I thought might work based on my coding experience but it all just threw an error. Any useful links or possible solutions would be appreciated.
Thanks, Zack

Left ( Surname, 1 )
More information here
.
Also:
Calculated fields belong in queries, not tables.
More information from Allen Browne here

Related

Google App Maker Query Builder

Created a simple app to keep track of the company fax numbers. In my header I have a search box where I want user's to search either by First Name, Last Name or both First and Last Name. I added the below to Query Builder
firstName contains? :SearchText or
lastName contains? :SearchText
Searching by first name or last name works just fine. How can I search by both first and last name? Right now when I search by both I get no results. Thanks.
"User Picker" widget should be a good fit for your case.
If you want to keep custom employees model please consider the following options:
Add Name field ("FirstName LastName") so contains operator would give expected result
Switch datasource to Query Script and process search query
(https://developers.google.com/appmaker/models/datasources#query_script)

Netsuite - Saved Search - String All True Results of Case Formula

Hoping someone can help me out with a NetSuite question, and I apologize in advance if i’m misusing some lingo.
I am creating a item based saved search and one of my formula (text) result fields can have multiple true values when I apply my case formula. I’m look to combine all the true results of this formula into one comma separated string, instead of a new item row for each true value.
sku contact type
123 John S Owner
123 Jane S Clerk
123 Jack S Clerk
Formula (text) - Custom Label Field Name = Contact Name
Case when {type} = ‘Clerk’ then {contact} end
Currently my results generate a item (sku) row for each case of clerk:
Sku Contact Name
123 Jane S
123 Jack S
I’m looking for my results to be a single string
Sku Contact Name
123 Jane S, Jack S
I know the case function noted above will not string the results by itself; I originally intended to use the group by and max summary types, but I only get one Contact Name result.
Any solutions or work arounds?
Thanks
There are certain grouping functionality available for saved search results, but I don't think what you are trying to do is possible.
If you group your results by Sku, you will get one line per Sku but concenating the contact names from different line results I don't think is possible.
In your SaveSearch's Filter look for mainline and try to set either true(Yes) Or false(No).
There is an undocumented Netsuite function NS_CONCAT() (similar to Oracle's undocumented WM_CONCAT()) that does exactly this. You would group your results by the SKU column, and add formula field with the formula NS_CONCAT({contact}) and the summary type set to Minimum or Maximum.
According to some Netsuite employees on the Netsuite User Group, the LISTAGG function should also work now, and offers more flexibility (if you wanted a delimiter other than a comma for example).

Enter data in mother table using data from child tables

Hi all,
I have 3 tables in an access 2010 database:
Crew: CrewID; Name; Adres;...
Voyage: VoyageId; Voyage name; Departure harbour; Arrival harbour
Crewlist: CrewlistId, VoaygeId, CrewId, Rank
The VoaygeId and CrewId from the Crewlist table are linked (relation) to the autonumber ID's from tables 2 and 1.
My first and main question is: Upon boarding everyone has to ‘sign in’ selecting the voyage and there name, and assign them a roll (of to be donde by the responsible officer). How can I make a form that lets the users browse through the voyagenames and crewnames in stead of the ID’s uses in the ‘mother’ table (table 3: Crewlist)
2nd question: how can I make sure that someone isn’t enrolled twice for the same voyage (adding same voyagenumber and same crewId number in crewlist). This would preferably be blocked upon trying to add the same person a second time on a voyage.
To prevent duplicates in Crewlist, add a unique index to the table on both CrewId and VoyageId
It would be a good idea to add relationships and enforce referential integrity
You are now in a position to use the wizards to create a form based on Voyage and a subform based on CrewList with a combobox based on Crew
There are a number of refinements you could add.
Make sure you do not use reserved words like Name and do not put spaces in field names. You will thank yourself later.
See also create form to add records in multiple tables

Get peoples surnames or christian names from freebase?

Is it possible to get a users first name or surname from a freebase query?
For example, I have a person entry I have the id of, but I just want to extract their first name.
{
"id": "/en/paul_thomas_anderson",
"name" : null
}​
How would I modify this query, its something I've found nothing about by googling or searching here on S.O.? I know this kind of thing is possible in dbpedia for most people entries.
No, it's not possible directly. The name is stored as a single unit. There are topics for given names and surnames (e.g. http://www.freebase.com/view/base/givennames/given_name), so you could split the name and see which list(s) it appears in, but that's indirect and doesn't tell you about the specific person you are querying.

Search postcode or town

I need to search some data depending on whether user enters a postcode or a town. Since the town and the postcode is stored in different columns, how can I distinguish whether it is a postcode or a town and pass it on to query?
Can't see why you'd need to distinguish. Just check both columns.
SELECT * FROM MyTable WHERE Postcode = #searchString OR Town = #searchString
You can use a regular express sentence to check whether it is a postcode or not, if not, treat it as a town name then.
How to valid a postcode? it depends on what language you are using, here is an example how to valid in PHP:
http://www.ukpostcode.net/validating-uk-postcodes-with-php-wiki-8.html
you can also find the scripts in javascripts and foxpro. good luck!
you should get user selection whether he want to search in postcode or a town. If you don't want that then you can run your query in both column one by one. ie search on postcode if found then ok else run on town. or you can join two columns result in one column and search accordingly. although first option is more optimized.
oops i missed or operator. my bad

Resources