subform with 2 child/masterfields but one with expression?

A

azu_daioh

Please Help!

I'm trying to link using 2 fields but one of the fields is an
expression.

Table1 fields:
License# (key)
ccDate (mm/dd/yyyy)

Table2 fields:
LicenseNum
enterYear (unbound textbox)


I would like to be able to view only the certain year in my subform.
And the user has the capacity to indicate which year (by using the
[enterYear] textbox) to display.

This is what I have:

Link Master Fields: LicenseNum;enterYear
Link Child Fields: License#,ccYear

ccYear is an expression from a query --> ccYear:Year([ccDate])

The above works but each time I tried to enter/change new records in
the subform I get an error message "Field cannot be updated" --> I
found out it was due to the fact that I'm using an expression in the
query as my link field.

Is there a way I can avoid the error message? Any idea? please.

Thanks,

Sharon
 
S

strive4peace

Hi Sharon,

could be a type, but "License#,ccYear" needs to be delimited with
semi-colon (;) not comma

since ccYear is a calculated field, you cannot change it directly;
changes must be made to the field it is calculated from, ccDate

what you may want to do is this:

on the AfterUpdate event of ccYear -->
me.dirty = false

this will cause the record to be saved. Then you will need to requery
(or refresh may work too) to get the calculated field to update.

what tables are your mainform and subform based on?


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
A

azu_daioh

Hi Crystal,

Thanks for responding. I was able to fix this problem using the
AfterUpdate field.

Thanks again.
Sharon
 
S

strive4peace

you're welcome, Sharon ;) happy to help

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top