concatenate text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a saved query that calculates the number of records in a table and
adds 1 to it. Quote Count is the query and Total is the calculated field.
Here's the code, Total: Count([QuoteID])+1. I am trying to use this in
combination with the current year in a text box. For example I would like to
disaplay 2005-132 in a text box. I am drawing a blank on where to place this
code, where on the form would it go? Here's what I have right now:
=Year(Date()) & "-" & [Quote Count]![Total] I just don't know where to put
it.

Thanks in advance for your help.
Karen
 
Karen,

Is the Quote Count query, and in particular the Total field, included in
the Record Source of the form? If so, the expression you used (almost)
should be placed in the Control Source property setting of an unbound
textbox on the form...
=Year(Date()) & "-" & [Total]

--
Steve Schapel, Microsoft Access MVP

Hi,
I have a saved query that calculates the number of records in a table and
adds 1 to it. Quote Count is the query and Total is the calculated field.
Here's the code, Total: Count([QuoteID])+1. I am trying to use this in
combination with the current year in a text box. For example I would like to
disaplay 2005-132 in a text box. I am drawing a blank on where to place this
code, where on the form would it go? Here's what I have right now:
=Year(Date()) & "-" & [Quote Count]![Total] I just don't know where to put
it.

Thanks in advance for your help.
Karen
 
Hi Steve,

I have a field on the page called Total and another field on the page called
Year. The Total field I have the default value set =[Quote Query]![Total]
and the Year field has the default value set to Year(Date()). The Year field
is working, but the Total field doesn't display the correct value. Could it
have anything to do with the field is a text box? I don't see Record Source
on the form field. I do see Control Source.

Any more suggestions would be appreciated.

Thanks,
Karen

Steve Schapel said:
Karen,

Is the Quote Count query, and in particular the Total field, included in
the Record Source of the form? If so, the expression you used (almost)
should be placed in the Control Source property setting of an unbound
textbox on the form...
=Year(Date()) & "-" & [Total]

--
Steve Schapel, Microsoft Access MVP

Hi,
I have a saved query that calculates the number of records in a table and
adds 1 to it. Quote Count is the query and Total is the calculated field.
Here's the code, Total: Count([QuoteID])+1. I am trying to use this in
combination with the current year in a text box. For example I would like to
disaplay 2005-132 in a text box. I am drawing a blank on where to place this
code, where on the form would it go? Here's what I have right now:
=Year(Date()) & "-" & [Quote Count]![Total] I just don't know where to put
it.

Thanks in advance for your help.
Karen
 
Karen,

A Form has a Record Source property, which is the table or query that
provides the data for the form. Forms do not have fields. Tables and
queries have fields. Forms have Controls. Controls on forms have a
Control Source property. They can be bound or unbound. If they are
bound, it means that there is an entry in the Control Source that
indicates a field from the form's Record Source. Does that help?

It is invalid syntax to try and refer to a field in a query like [Quote
Query]![Total] this doesn't mean anything to Access, and even if it did,
it wouldn't know what to do with it, as there is no way to indicate
which record in the query you want it to use.

Besides, I got confused between [Quote Query] and [Quote Count]... are
these the same thing, just you have changed the names somewhere along
the line?

If the form is *not* based on this query, then you could use a domain
function. As mentioned in my previous post, it is the Control Source
property of the textbox you want here, not the Default Value property.
It might Look like this...
=DLookup("[Total]","Quote Count")

If this was the case, in fact the query is redundant, as you could refer
back directly to the table that the Quote Count query uses, and put this
on your form...
=DCount("*","NameOfTable")+1

--
Steve Schapel, Microsoft Access MVP

Hi Steve,

I have a field on the page called Total and another field on the page called
Year. The Total field I have the default value set =[Quote Query]![Total]
and the Year field has the default value set to Year(Date()). The Year field
is working, but the Total field doesn't display the correct value. Could it
have anything to do with the field is a text box? I don't see Record Source
on the form field. I do see Control Source.

Any more suggestions would be appreciated.

Thanks,
Karen
 
Back
Top