How to set the field value based on the other value on same form?

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

Guest

Hi,

I have an incident occurrence form which has the record source -- incident table. The table has a primary key-track No., which is an autonumber, and also an incident case ID which has the same value as the primary key. The form is used to input information. What I want is to set the incident case ID to get the value of primary key after it is generated (automatically shows on the form), the value of incident case ID in the incident table will be updated also.
What I've already done are as below, but they didn't work:
1.set the afterUpdate event for the track No. text box; set the beforeUpdate event for the incident case ID; then I tried to set them both.The code I set is: Me.IncidentCaseID = Me. trackNo
2.set the text in control source as: =[trackNo] By this way, the value in incident case ID text box(on the form) changed but the incident case ID field in the incident table didn't been changed, thus it can't be carried to the next form, which uses the value of incident case ID field in the table.
3. I tried to set the default value of incident case ID to the value of track No. The cose I use was: Me![trackNo].DefaultValue = Me![trackNo], I am not sure about whether it is correct.

Does anyone know how to solve this problem? I've spent a whole day today on it, but didn't get any result. Thanks in advance!

-- Flora
 
This article explains when the Autonumber value is accessible and how to
access it.
http://support.microsoft.com/default.aspx?scid=kb;en-us;221931

--
Kailash Kalyani
MEA Developer Support Center
ITWorx on behalf of Microsoft EMEA GTSC

Flora said:
Hi,

I have an incident occurrence form which has the record source -- incident
table. The table has a primary key-track No., which is an autonumber, and
also an incident case ID which has the same value as the primary key. The
form is used to input information. What I want is to set the incident case
ID to get the value of primary key after it is generated (automatically
shows on the form), the value of incident case ID in the incident table will
be updated also.
What I've already done are as below, but they didn't work:
1.set the afterUpdate event for the track No. text box; set the
beforeUpdate event for the incident case ID; then I tried to set them
both.The code I set is: Me.IncidentCaseID = Me. trackNo.
2.set the text in control source as: =[trackNo] By this way, the value
in incident case ID text box(on the form) changed but the incident case ID
field in the incident table didn't been changed, thus it can't be carried to
the next form, which uses the value of incident case ID field in the table.
3. I tried to set the default value of incident case ID to the value of
track No. The cose I use was: Me![trackNo].DefaultValue = Me![trackNo], I am
not sure about whether it is correct.
Does anyone know how to solve this problem? I've spent a whole day today
on it, but didn't get any result. Thanks in advance!
 
Back
Top