Clearing fields on a form

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

Guest

I have a form linked to a table that has a key(ID). They wanna use that id
again but change all the info. The easiest was is to just enter the new info
over the old. But I would like to delete/clear all the info out. In the
code I did an edit and set the text fields to " " using table.var = " " but
when I do the update, it cleared the first record.
I did a find first but got a msg saying I could not use a find now. I tried
an update query but didn't work. What am I not doing.

Mike
 
Because you are using a bound form, if you clear all the controls on your
form, it will update the current record with nulls. Another way to do this
would be to make it appear you are clearing the controls and using the key
again (duplicate keys? is that what you really want?), use a command button
to create the effect. In the button's Click Event:

Dim strKey as String (or whatever data type your key field is)

strKey = Me.txtKeyField
DoCmd.GotoRecord acNewRec
Me.txtKeyField = strKey
 
Back
Top