By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,490 Members | 1,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,490 IT Pros & Developers. It's quick & easy.

Trying to combine a field value and a string

P: n/a
I have a field called Order No, I want its value to be a combination of this
string "P000" and the value of the [Transaction number]. I tried this:

[Order No] = [Transaction Number]
Or

[Order No] = "P000"

If I want to combine the two values what is the VBA function for it

I tried the following

[Order No] = "P000" + [Transaction Number]
[Order No] = "P000" And [Transaction Number]
[Order No] = "P000" & [Transaction Number]
[Order No] = "P000" , [Transaction Number]

They all give me error messages, I know it's a simple thing but I know very
little about vba any help?

Thanks guys
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Where are you trying this?

You could put the 3rd one into the AfterUpdate event procedure of
Transaction Number.

However, if the value should *always* be P000 and the transaction number,
you don't need a field for it at all. You could just set the Control Source
of your text box to:
="P000" & [Transaction Number]

More info on when and how to use calculated fields:
http://allenbrowne.com/casu-14.html

--
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.

"Paolo" <pr*****@netspace.net.au> wrote in message
news:d0***********@otis.netspace.net.au...
I have a field called Order No, I want its value to be a combination of
this string "P000" and the value of the [Transaction number]. I tried this:

[Order No] = [Transaction Number]
Or

[Order No] = "P000"

If I want to combine the two values what is the VBA function for it

I tried the following

[Order No] = "P000" + [Transaction Number]
[Order No] = "P000" And [Transaction Number]
[Order No] = "P000" & [Transaction Number]
[Order No] = "P000" , [Transaction Number]

They all give me error messages, I know it's a simple thing but I know
very little about vba any help?

Thanks guys

Nov 13 '05 #2

P: n/a
It worked with the & the second time thank you
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:42**********************@per-qv1-newsreader-01.iinet.net.au...
Where are you trying this?

You could put the 3rd one into the AfterUpdate event procedure of
Transaction Number.

However, if the value should *always* be P000 and the transaction number,
you don't need a field for it at all. You could just set the Control
Source of your text box to:
="P000" & [Transaction Number]

More info on when and how to use calculated fields:
http://allenbrowne.com/casu-14.html

--
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.

"Paolo" <pr*****@netspace.net.au> wrote in message
news:d0***********@otis.netspace.net.au...
I have a field called Order No, I want its value to be a combination of
this string "P000" and the value of the [Transaction number]. I tried
this:

[Order No] = [Transaction Number]
Or

[Order No] = "P000"

If I want to combine the two values what is the VBA function for it

I tried the following

[Order No] = "P000" + [Transaction Number]
[Order No] = "P000" And [Transaction Number]
[Order No] = "P000" & [Transaction Number]
[Order No] = "P000" , [Transaction Number]

They all give me error messages, I know it's a simple thing but I know
very little about vba any help?

Thanks guys


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.