View Full Version : Help Please - Pasting/Copying Feature?


Sparky
02-02-2001, 12:50 AM
I don't know if this is possible but I need to enter a matric number into a new record on a form, the form searches for the same matric number in an imported table and then enters the surname, christian name, room number and residence into the new record on the form and stores that information in the table the form is based on.

Whether it can be done in a form of a button once pressed the procedure takes place, that would be ideal.

Many thanks for any help.

ntp
02-03-2001, 10:07 AM
You can use the afterupdate event for the control where the matric number is being entered. In the afterupdate event procedure, run some query that will return the values you need. Take the returned values and assign them to the other controls.

e.g

Private Sub txtMatricNumber_AfterUpdate()
Dim rst as Recordset

set rst = currentdb.openrecordset("SELECT surname,cname,rnumber,residence FROM Tabl1 WHERE matricNumber =" & me.txtMatricNumber)
me.txtSName = rst!surname
me.txtCName = rst!cname
me.txtRoomNumber = rst!rnumber
me.txtResidence = rst!Residence
rst.close
Set rst = Nothing
End Sub

ntp