Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

what is the code for deleting a new record?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
baby_swallow - 28 Feb 2005 19:51 GMT
I have different subforms inside a form, while 2nd subform depends on the
number indicating on the 1st subform. That is, if there exists the number
"1", there should be only 1 record in the 2nd subform. I've already
constrained it with the following code:

Private Sub Seg__AfterUpdate()
   If Me.Seg_ > [Forms]![PROJECT_Information]![Segments] Then
   MsgBox "The maximum segment number can not be greater than the project's
segment number!"
   End If
End Sub

but when I enter a "2" in the new record "Seg_", the new record exists for
user to enter data, that there are 3 rows (with 2 empty record) instead of
only 1 record that i want. What code should I insert in order to delete the
empty records (row) ? I also want to prevent people to insert anything except
for the correct number, can I make it to delete the new record when the error
message is shown?
Thank you everyone!
John Vinson - 01 Mar 2005 02:57 GMT
>I have different subforms inside a form, while 2nd subform depends on the
>number indicating on the 1st subform. That is, if there exists the number
[quoted text clipped - 15 lines]
>message is shown?
>Thank you everyone!

I'd recommend using the second subform's BeforeInsert event instead;
set its Cancel argument to True (with a user warning) *before* the
record is added, rather than letting the user add one and then
slapping their hand afterward.

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.