Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clearing data off of a form...

Status
Not open for further replies.

Dre313

Technical User
Jun 4, 2003
219
US
I have a form .. which user enters in data.. then they click the add button msgbox comes up and ask if user was the save..

user clicks yes..

then andother msgbox pops up ... stating info as been added.. User clicks ok..

another message box pops up asking if the user wants to add another record ...

If the user clicks yes.. msgbox comes up telling the user what record they are on... ( doing this because user needs to enter in the record number.. for another part of the app )

my question is..

when the user clicks ok to the last msgbox.. (the one where it tells him/her which record is next) its puts them back on the original form with the orginal data.. i want to blank out the form.. so user can enter in new data w/o having to see old data.... how would i do this...


here is some of my code...


Select Case MsgBox("Do you want to save your changes to the current record?" & vbCrLf & vbLf & " Yes: Saves Changes" & vbCrLf & " No: Does NOT Save Changes" & vbCrLf & " Cancel: Reset (Undo) Changes" & vbCrLf, vbYesNoCancel + vbQuestion, "Save Current Record")
Case vbYes: 'Save the changes
Set RS = CurrentDb.OpenRecordset("tblOpen", dbOpenTable)
With RS
.AddNew
!AuditItem = AuditItem.Value
!Leader = Leader.Value
!Members = Members.Value
!Location = Location.Value
!Shift = Shift.Value
!AdateOpen = AdateOpen.Value
!Responsibility = Responsibility.Value
!AuditFocus = AuditFocus.Value
!AuditItemIdentified = AuditItemIdentified.Value
!Timing = Timing.Value
!OpenorClose = OpenorClose.Value
.Update
.Close
End With
AuditItem.SetFocus
AuditNo = AuditItem.Text
AdateOpen.SetFocus
OpenDate = AdateOpen.Text
Leader.SetFocus
Leading = Leader.Text
strsql = "INSERT INTO tblClose (AuditItem, AdateOpen, Leader) VALUES ('" & AuditNo & "', #" & OpenDate & "#, '" & Leading & "');"
DoCmd.RunSQL strsql
MsgBox "Audit Item: " & AuditNo & vbCrLf & "Open Date: " & OpenDate & vbCrLf & "Leader: " & Leading & vbCrLf & vbCrLf & "Has Been Updated!", vbInformation, "Updating Audit"

Select Case MsgBox("Would you like to add another audit?" & vbCrLf & vbLf & " Yes: Add New Audit" & vbCrLf & " No: Does NOT Save Changes" & vbCrLf & vbCrLf, vbYesNo + vbQuestion, "Add Another Audit?")
Case vbYes: 'Save the changes
Dim db As DAO.Database
Dim tdef As DAO.TableDef

Set db = CurrentDb()
Set tdef = db.TableDefs("tblOpen")


MsgBox "Begin next audit with Audit No: " & tdef.RecordCount + 1
DoCmd.OpenForm "frmOpenAudit"
DoCmd.GoToRecord , , acNewRec

Case vbNo: 'Do not save or undo
'Do nothing
End Select




thanks
 
I've used code similar to this in the past -

Dim objControl As Control

For Each objControl In Me.Controls
If TypeOf objControl Is TextBox Then
objControl = ""
ElseIf TypeOf objControl Is CheckBox Then
objControl = 0
ElseIf TypeOf objControl Is ListBox Then
objControl = ""
ElseIf TypeOf objControl Is ComboBox Then
objControl = ""
End If
Next objControl

Hope it helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top