View Full Version : Autocomplete within a form


janed
04-28-2002, 02:29 AM
I have ten fields within a form which are linked to a table "A". The first five fields within this form should work as normal updating themselves to table "A". However i would like the last five to work as follows: If the first two fields of the last five contain data enteries matching data in a table "B" (whch ther can be only one istence of) I want the last three fields in the form to be automatically completed with data from table "B" and are then subsequentely entered in table "A".

Please help me!!!

Jack Cowley
04-28-2002, 06:28 AM
In the After Update event of field 7 something like this should work:

If Not IsNull(DLookup(Look For Match for field 6)) and Not IsNull(DLookup(Look For Match for field 7)) Then
Me![Field8] = DLookup(...)
Me![Field9] = DLookup(...)
Me![Field10] = DLookup(...)
Else
MsgBox "No Matches Found."
End If

You could use more sophisticated code but this should work for you...