CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 [RESOLVED] insert concatenated value when adding new record

Print topic Send  topic

Author Message
tregc

Posts: 2
Posted: 12/16/2008, 1:38 PM

Hi,

When a user makes a new record, I would like to have one of the fields (CitationID) populated by concatenating from two other fields (Authors and Year) that they have just added values to (e.g. "Smith2001").

So there are few questions:
1. Does it matter what the CitationID control is (I tried using both label and textbox), since the user is not entering data for this field?

2. On what event do I add any value (ignoring concat issue) to the CitatiodID field?
I've tried adding server-side code to the "Add" button of a record form (insert onclick function) but it isn't working. I've also tried to add it to the form's ("BibRecord") various insert events. No errors but the field is empty when looking at the grid's("Bibliography") record.
BibRecord.CitationID.Value="teststring"

3. Will it be a different event if the new value comes from concatenating values that have just been added by the user to the record form?


dim strAuthor
dim strYear
strAuthor=request.Form("Authors")
strYear=request.form("PubYear")
BibRecord.CitationID.Value=(strAuthor + strYear)

Thanks in advance for any advice you folks can provide,
tregc
View profile  Send private message
tregc

Posts: 2
Posted: 12/17/2008, 3:01 PM

Ok I got it solved.

1. The correct event is the record form's 'before insert' event. Not the Add button event.
2. The CitationId control needs to be a textbox or hidden control. Label control won't work.
3. It is the record form (BibRecord) that needs to be referenced not the underlying table (bibliography).

Code for the concatenation looks like this:
BibRecord.CitationID.Value = left(BibRecord.Authors.Value,14) + "-" + cstr(BibRecord.PubYear.Value) + "-" + left(BibRecord.Title.Value,17)
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.