473,508 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

query question

266 Contributor
i have an append query that sends data to a form. i was wondering if for one of the fields if i could just send the first letter. so if the record says "test" i would like it to only display "t" in the field on the form... is that possible... thanks!
Mar 10 '09 #1
4 960
Stewart Ross
2,545 Recognized Expert Moderator Specialist
You can use a simple unbound textbox in the form to do this, using as its control source the Left function to extract the first character from the field concerned. I have also used the Nz function to substitute for nulls in the example below, which will avoid a run-time error that would otherwise occur if Left is applied to a field that has no current value (i.e. is null):

=Left (Nz ([your field name], ""), 1)

You could include this in the query you mention as a calculated field if you prefer.

-Stewart
Mar 10 '09 #2
didacticone
266 Contributor
when i put that string in the control source field of an unbound text box, the box returns "#error" .... any idea as to what i could be doing wrong.. this is the code i used

=Left(Nz([town],""),1)
Mar 10 '09 #3
Stewart Ross
2,545 Recognized Expert Moderator Specialist
The #Error occurs when the name of a field or control - [Town] in this case - either does not exist, or is already in use, or if the name of a function is unrecognised.

Check that the unbound control does not have the same name - Town - as you are trying to feed into its control source expression. Check also that the field you have named - Town - exists in the query or table you are using as the recordsource of your form. If it does not you will certainly get an error when you try to refer to it!

If this is OK then check what happens if you remove the Nz function - so just leaving

=Left([Town], 1)

I have come across some occasions when Nz is not recognised as valid. If this does occur, replace the expression with:

=IIF([IsNull([Town]), "", Left([Town], 1))

-Stewart
Mar 10 '09 #4
didacticone
266 Contributor
that was the problem lol... i have the text box the same name as the field... thanks so much for your help.. it works great!
Mar 10 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3396
by: majsen | last post by:
Hi, I have problem running this query. It will time out for me... My database are small just about 200 members. I have a site for swaping appartments (rental). my query should look for match in...
8
3226
by: Együd Csaba | last post by:
Hi All, how can I improve the query performance in the following situation: I have a big (4.5+ million rows) table. One query takes approx. 9 sec to finish resulting ~10000 rows. But if I run...
3
14113
by: John Ortt | last post by:
> I have a table of dates in ascending order but with varying intervals. I > would like to create a query to pull out the date (in field 1) and then pull > the date from the subsequent record...
3
3058
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
7
3371
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
6
4815
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
2
2028
by: mmitchell_houston | last post by:
I'm working on a .NET project and I need a single query to return a result set from three related tables in Access 2003, and I'm having trouble getting the results I want. The details: ...
22
31147
by: Stan | last post by:
I am working with Access 2003 on a computer running XP. I am new at using Access. I have a Db with a date field stored as mm/dd/yyyy. I need a Query that will prompt for the month, ie. 6 for...
3
2054
by: Richard Hollenbeck | last post by:
I am very sorry about the (almost) re-post, but you will see that my first question wasn't very clear; I have another question I posted this morning called, "in DAO: Run time error 3061 Too few...
16
3462
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.