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