473,382 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

appending prefix to a report field

I am attempting to append a string prefix to a report field which is
based on a query result. I want the user to be able click a checkbox
on the form which opens the report to determine whether the string is
appended or not. I see that this can be done in the properties of the
field, but I cannot figure out if it can be done with VB code. Since
it needs to be an option, I cannot do it in the properties (at least
as far as I know). Is this possible and if so, how is it done?
Thanks in advance.
Nov 13 '05 #1
4 3871
Set the Control Source of the text box on your report to something like
this:
=IIf([Forms].[Form1].[Checkbox1]=True, "My prefix ", Null) & [Field2])

Note that you should also change the Name property of the text box. If it
has the same name as the Field but is bound to something else, Access gets
confused.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Zenon" <ze****@comcast.net> wrote in message
news:b1**************************@posting.google.c om...
I am attempting to append a string prefix to a report field which is
based on a query result. I want the user to be able click a checkbox
on the form which opens the report to determine whether the string is
appended or not. I see that this can be done in the properties of the
field, but I cannot figure out if it can be done with VB code. Since
it needs to be an option, I cannot do it in the properties (at least
as far as I know). Is this possible and if so, how is it done?
Thanks in advance.

Nov 13 '05 #2
Thanks for the help, however, I still can't get this to work. In my
test case, I have a form cleverly called TestForm. On it is a
checkbox called Check6, and a button which opens a report called
ReportTest based on a query called Query1. I have renamed Field1 on
the report to FieldOneName, and have entered the following formula in
it's control source. At this time, I'm not even worried about adding
the prefix but just getting the IIf statement to work. Do you see
what I'm doing wrong?

=IIf([Forms]![TestForm]![Check6]=True,([FieldOneName]="Checked"),([FieldOneName]="Not
Checked"))

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<41***********************@per-qv1-newsreader-01.iinet.net.au>...
Set the Control Source of the text box on your report to something like
this:
=IIf([Forms].[Form1].[Checkbox1]=True, "My prefix ", Null) & [Field2])

Note that you should also change the Name property of the text box. If it
has the same name as the Field but is bound to something else, Access gets
confused.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Zenon" <ze****@comcast.net> wrote in message
news:b1**************************@posting.google.c om...
I am attempting to append a string prefix to a report field which is
based on a query result. I want the user to be able click a checkbox
on the form which opens the report to determine whether the string is
appended or not. I see that this can be done in the properties of the
field, but I cannot figure out if it can be done with VB code. Since
it needs to be an option, I cannot do it in the properties (at least
as far as I know). Is this possible and if so, how is it done?
Thanks in advance.

Nov 13 '05 #3
Try:
=IIf([Forms]![TestForm]![Check6]=True,"Checked","Not Checked")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Zenon" <ze****@comcast.net> wrote in message
news:b1**************************@posting.google.c om...
Thanks for the help, however, I still can't get this to work. In my
test case, I have a form cleverly called TestForm. On it is a
checkbox called Check6, and a button which opens a report called
ReportTest based on a query called Query1. I have renamed Field1 on
the report to FieldOneName, and have entered the following formula in
it's control source. At this time, I'm not even worried about adding
the prefix but just getting the IIf statement to work. Do you see
what I'm doing wrong?

=IIf([Forms]![TestForm]![Check6]=True,([FieldOneName]="Checked"),([FieldOneN
ame]="Not Checked"))

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message

news:<41***********************@per-qv1-newsreader-01.iinet.net.au>...
Set the Control Source of the text box on your report to something like
this:
=IIf([Forms].[Form1].[Checkbox1]=True, "My prefix ", Null) & [Field2])
Note that you should also change the Name property of the text box. If it has the same name as the Field but is bound to something else, Access gets confused.
"Zenon" <ze****@comcast.net> wrote in message
news:b1**************************@posting.google.c om...
I am attempting to append a string prefix to a report field which is
based on a query result. I want the user to be able click a checkbox
on the form which opens the report to determine whether the string is
appended or not. I see that this can be done in the properties of the
field, but I cannot figure out if it can be done with VB code. Since
it needs to be an option, I cannot do it in the properties (at least
as far as I know). Is this possible and if so, how is it done?
Thanks in advance.

Nov 13 '05 #4
Beautiful, thanks very much. This expression worked perfectly.

=IIf([Forms]![TestForm]![Check6]=True,"Checked " & [Field1],"Not Checked")

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<41***********************@per-qv1-newsreader-01.iinet.net.au>...
Try:
=IIf([Forms]![TestForm]![Check6]=True,"Checked","Not Checked")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Zenon" <ze****@comcast.net> wrote in message
news:b1**************************@posting.google.c om...
Thanks for the help, however, I still can't get this to work. In my
test case, I have a form cleverly called TestForm. On it is a
checkbox called Check6, and a button which opens a report called
ReportTest based on a query called Query1. I have renamed Field1 on
the report to FieldOneName, and have entered the following formula in
it's control source. At this time, I'm not even worried about adding
the prefix but just getting the IIf statement to work. Do you see
what I'm doing wrong?

=IIf([Forms]![TestForm]![Check6]=True,([FieldOneName]="Checked"),([FieldOneN
ame]="Not
Checked"))

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message

news:<41***********************@per-qv1-newsreader-01.iinet.net.au>...
Set the Control Source of the text box on your report to something like
this:
=IIf([Forms].[Form1].[Checkbox1]=True, "My prefix ", Null) & [Field2])
Note that you should also change the Name property of the text box. If it has the same name as the Field but is bound to something else, Access gets confused.
"Zenon" <ze****@comcast.net> wrote in message
news:b1**************************@posting.google.c om...
> I am attempting to append a string prefix to a report field which is
> based on a query result. I want the user to be able click a checkbox
> on the form which opens the report to determine whether the string is
> appended or not. I see that this can be done in the properties of the
> field, but I cannot figure out if it can be done with VB code. Since
> it needs to be an option, I cannot do it in the properties (at least
> as far as I know). Is this possible and if so, how is it done?
> Thanks in advance.

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: the hotshot | last post by:
hello, this seems to be a hard question so far and noone has been able to help with this. is it possible to have access start an autonumber with a prefix according to the year when the data is...
9
by: Selvesteen | last post by:
Hello Gurus, I need to append a sub-string at the start of strings using C. What is the best way to achieve that? for eg : I need to append "SSL"_ before { CLASS, SEED, RANDOM } to get result...
5
by: jason.teen | last post by:
Hi, I'm trying to create Keys with different prefix characters for each product I have. So for every product requires a different prefix character, but the number will auto increment by itself...
3
by: manojspromantr | last post by:
I'm trying to append some data from one table to another table both the table structure are same. I have an attachments field in both tables but it seems that i cannot append the attachments from one...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.