karatelung
04-17-2001, 09:46 AM
I want to make my subform just a little more user-friendly.
When a user hits the "New Record" button, I want the new record in the subform to display the same data as the previous record in the subform on certain fields.
Can someone help me with the code for the "OnClick" property, or is there a better way?
Richie
charityg
04-17-2001, 10:08 AM
dim db as database
dim rst as recordset
set db=currentdb
set rst=db.openrecordset("underlyingtable",dbopendynaset)
rst.addnew
rst!field1=me!field1
rst!field2=me!field2
rst!field3=me!field3
rst.update
me.bookmark=rst.bookmark
This should work, I may be wrong on the bookmark part. This just makes the form go to the new record, but it's off the top of my head.
charityg
04-19-2001, 06:18 AM
try
rst=db.openrecordset("tblName") instead of the previous code. This should allow Access to default to the correct recordset type.
karatelung
04-19-2001, 09:50 AM
Charity,
I'm still getting the same error - "run-time error: 314 type mismatch concerning the line:
Set Rst = db.OpenRecordset("table")
I found this interesting information, ACC2000:"TYPE MISMATCH WHEN COMPARING BOOKMARKS (http://support.microsoft.com/support/kb/articles/Q198/6/48.ASP?LN=EN-US&SD=gn&FR=0&qry=type%20mismatch&rnk=5&src=DHCS_MSPSS_gn_SRCH&SPR=ACC2000), in the Microsoft Knowledge base, but I still can't solve my problem.
Any more suggestions? From anyone?
Thank you, Charity, and all the other helpful Access developers.