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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unintentional save when closing form ???

Status
Not open for further replies.

Schaap

Technical User
Jul 6, 2004
54
NL
When I close an fill in form, that I saved before (.update all the fields into database) with a save button on the form, I get an access messagebox that there are 2 users who are using this form ! And I (= user 2) can save it again but the information (saved by the save button (= user 1) will be lost or I can cancel it. But everytime I close this form I get this unwanted message.

It's possible to solve this problem/message when I set the property settings of this form to NO for: allow edit, allow change and allow delete and bolt all the fields on the form. So I get an fill in form where it's not possible to fill in or change something !!! So that's not what I want offcourse !!!

Does someone know how to handle this ?

The code of the form:

Private Sub Form_Load()
Me.LastChangedBy = username
Me.LastChangeDate = Datum
Offerte = ""
Slide = ""
Foto = ""
StrFilePath = ""
stPath = ""
Index = IndexNumber
Set Db = CurrentDb()
Set Rs = Db.OpenRecordset("Select InvestmentPurpose FROM InvestmentPlanning WHERE IndexNumber=" & Index)
Me.SelectInvestmentPurpose = Rs!InvestmentPurpose
Rs.Close
Set Rs = Nothing
End Sub

Private Sub Save_Click()
Set Db = CurrentDb()
Set Rs = Db.OpenRecordset("select Offer, EstimatedPrice, PowerPointSlide, Photo, Capital, Expense, EEA, ROI, PaccarProjectNumber, Agreed, CarryOver, SbonNumber, SbonDate, FinishedSbonDate, ProductReceived, ChangeDate, ChangedBy From Investmentplanning where IndexNumber=" & Index)

With Rs
.Edit
!EstimatedPrice = Me.NewEstimatedPrice
!SbonNumber = Me.NewSbonNR
!SbonDate = Me.NewSbonDate
!FinishedSbonDate = Me.NewFinSbonDate
!ChangeDate = Date
!ChangedBy = username
.Update Rs.Close
Set Rs = Nothing
MsgBox("Form saved")
'DoCmd.Close
DoCmd.OpenForm "StartFormBeheerder", acNormal
End With
End Sub
 
Where are your variable Dimm'ed? I don't see them anywhere, unless you have them setup as public or global variables.

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top