beforeupdate, update many records

  • Thread starter Thread starter balu
  • Start date Start date
B

balu

dear friends,
privatesub myform_befreupdate(cancel as integer)
'ow to update multiple records to same table ay one event
'im usingcode
dim dbs as dao.database
dim myrs as dao.recordset
set dbs=dbs.openrecordset("table")
if not isnull(me.option textbox) and me.optiontextbox = " 2 recordsupdate"
then
'update first record set
myrs.addnew
myrs!x=me.field1
myes!y = me.field2
myrs.update
msgbox "first set updated
'update second set
myrs.addnew
myrs!x = me.text20
myrs!y=me.text21
myrs.update
msgbox " second set updated"
else
'update first record set
myrs.addnew
myrs!x=me.field1
myes!y = me.field2
myrs.update
msgbox "first set updated
end if
docmd.gotorecord acdataform,"myform",acnewrec
end sub
(1) my problom is form not seting to new record
(2) before update event not completing
can any one help me please to update multiple records at one event or on
click event
balu
 
Well, this clearly isn't real code. It's always better to copy and paste
your real code rather than re-type it, as the re-typed code may not be an
exact match of the real code. The problem that exists in the real code may
not exist in the re-typed code, and problems may exist in the re-typed code
that do not exist in the real code.

In the re-typed code you've posted here, one obvious error is that there is
a space between "option" and "textbox" in the fourth line of code.
 
Back
Top