Alternate After Update Event

Moonshine

Registered User.
Local time
Today, 22:32
Joined
Jan 29, 2003
Messages
125
Hi

Ive got a continous forum, with several fields on there. They all look at the same table, and are populated after a OnClick event. However, there is one field that is there, but its not linked to anything on the table.

This is the description of a piece of equipment, only the Description CODE is held in the table, the Desciption itself is held in another table.

What i want it to do is update the field of description on the form from the CODE. Ive tried a couple of after update and lost focus events but it doesnt work..

is there any other way i could get it to populate the field?


PS: I tried putting it on the OnClick event of the button after all the processing is done, but as there are generally more than one Items on the form, it proceeds to update each description with the first.. which of course is wrong :(
 
I have tried using the code below, but now it updates all the records with the last records item descrpition. Using DeBug.Print i can see it does get each Different Item Description, but it just doesnt want to assign them seperatly... i guess that's because its a continuos form :(

Code:
     'Select all the equipment records that relate to this client
    Dim rstDescription
    Set rstDescription = CurrentDb.OpenRecordset("SELECT [tblE&A_EQUIPMENT_DETAILS].* " & _
    "FROM [tblE&A_EQUIPMENT_DETAILS] " & _
    "WHERE EQ_OT_FORM_ID = " & Me.txtForm_ID)
    
    'Using all of the above records, cycle down each one and using the Unique ITEM_ID
    'populate the the description field with the relevant Item Description
    With rstDescription
     Do
        'Obtain the Item Description from the holding table using the ITEM_ID
        Dim rstEquipmentID
        Set rstEquipmentID = CurrentDb.OpenRecordset("select * from tblEQUIPMENT_DESCRIPTIONS where ITEM_ID = " & rstDescription.ITEM_ID)
        
        'Assign the Item Description to the text field next to the ITEM_ID
        Me.ITEM_DESCRIPTION = rstEquipmentID.Fields![ITEM_DESCRIPTION]

        'Move onto the next record, until you reach the last record
        .MoveNext
     Loop Until .EOF = True
    End With
 
Can't you just use a combo box to do this?

???
 
Why not use a Dlookup function as an afterupdate event when you have entered the code.

Eg
With CodeContextObject
.[Description] = DLookup("[descriptionField]", "[TblDescriptions]", "[TblDescriptions].
Code:
=[Code]")
DoCmd.GoToControl "Description"
Forms!FrmNAME![description].SelStart = 255
End with
 

Users who are viewing this thread

Back
Top Bottom