Hi, I'm developing a subform for vegetation data collection in which, following completion of the subform, I want to write to a dbf file and then clear all fields in the subform in preparation for entering another record. (I have another sub which I use for the last record entered which writes to dbf and closes the subform). I can get the data written to the dbf file OK, and can enter subsequent records OK which again writes to the dbf file, however it won't clear the form.
Basically, I the subform is called "Plot Disturbance" into which data is entered in fields via combo boxes a text box. I then have a button which, when clicked, calls up a Sub called "WritetoSubFormPlotDist". This reads the subform field contents into dbf fields called "OID" (a reference to the site number), "Disturbance Type", "Severity", Age" and "Observed evidence". Because there may be a number of disturbances (records) at each site, I then want to enter the next disturbance type using the same subform and it would be very useful if the form cleared between record exports.
The text I am using is as follows:
Sub WritetoSubFormPlotDist
Set page = editform.pages.item("PgPlotDist")
Dim myRS
Set myRS = Application.CreateAppObject("RecordSet")
'open the Plot Disturbance DBF-file
myRS.Open "P:\Work\SSD\Users\Huxtac\ArcPad Stuff\Veg_16\Plot_DistOut.dbf",2
myRS.AddNew 'adds a new record
myRS.Fields("OID").Value = layer.Forms("EDITFORM").Pages("General1").Controls("OID")
myRS.Fields("DIST_TYPE").Value = layer.Forms("FrmPlotDist").Pages("PgPlotDist").Controls("CboDistType")
myRS.Fields("SEVERITY").Value = layer.Forms("FrmPlotDist").Pages("PgPlotDist").Controls("CboSevCode")
myRS.Fields("AGE").Value = layer.Forms("FrmPlotDist").Pages("PgPlotDist").Controls("CboAgeCode")
myRS.Fields("OBS_EVID").Value = layer.Forms("FrmPlotDist").Pages("PgPlotDist").Controls("EdtObsEvid")
myRS.Update 'saves information to the recordset Land Use DBF-file
myRS.Close
Set myRS = Nothing
Set page = editform.pages.item("PgPlotDist").Clear
End Sub
Any ideas - I've spent several days on this and it's driving me crazy! I thought that "MyRS.Clear" might work, but no!!
Charles