IT seems like the error self resolved. I adopted the 2nd fix to resolve the issue.
Thanks! I fixed the errors above.
1st fix: But I cant fix the Me.ID. They keep giving me back Method or data member not found. Even when I changed it to AuditTrailID, same error appears.
2nd fix: I changed it to Me!ID but now I get a Runtime error Type 13: type mismatched, Pointing at the line >>> Call AuditChanges("AuditTrailID", "Delete", Me.Name). Changed AuditTrailID to ID and to RecordID also returns the same error. I am lost already
Private Sub DeleteRecord_Click()
Dim rst As DAO.Recordset
Dim strCopy As String, strSQL As String
Dim answer As Integer
If IsNull(Me.Client) Then
MsgBox "No Record to delete"
Else
answer = MsgBox("Are you sure you want to delete this record)", vbYesNo + vbCritical + vbDefaultButton2, "Delete Confirmation")
If answer = vbYes Then
Call AuditChanges("AuditTrailID", "Delete", Me.Name)
strCopy = "Insert Into Deletedcustomer select SiteDetails.* from SiteDetails where (SiteDetails.ID = " & Me.ID & ");"
strSQL = "delete * from SiteDetails where ID= " & Me.ID
DoCmd.SetWarnings False
DoCmd.RunSQL strCopy
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
DoCmd.GoToRecord , , acNewRec
End If
End If
End Sub
I put it that way because There would be many clients with many individual sites. I want to keep the list of customers table clean. otherwise it would be messy with client names, sites and countries.
I was thinking that maybe they might have an problem later as they feed data into the database. Because they would need to remember CustSiteID number. Because when they are feeding the data into Site Details, the sites have names. So actually the build up is from "SiteDetails" >>> "CustSites" >>>> "CustomerList"
Would it be possible if the reference data for "CustSites" be from the "SiteName" field instead?
The PK fields are Autonumbers; Autonumbers are NOT intended to be viewed/used by end users of the application.Because they would need to remember CustSiteID number.
PK fields should NEVER be displayed.
Yes, you could... but WHY?? IMHO, it is better to use autonumbers than text fields. A PK field requires the data for that field to be unique.Would it be possible if the reference data for "CustSites" be from the "SiteName" field instead?
Read this site
Microsoft Access Tables: Primary Key Tips and Techniques
http://www.fmsinc.com/free/newtips/primarykey.asp
Pay special attention to this paragraph:Use a Meaningless Primary Key
Read this site many times.
Also see
Autonumbers--What they are NOT and What They Are
http://www.utteraccess.com/wiki/index.php/Autonumbers
Microsoft Access Performance Tips to Speed up Your Access Databases
http://www.fmsinc.com/microsoftaccess/Performance.html
Again, pay special attention to this paragraph: Primary Key Should be One Field and Numeric
(I've probably read these 3 sites more than 50 times)
Lets say you have a form bound to a query that is based on the table "SiteDetails".
The field "CustSitesID_FK", a Long Integer, is bound to a combo box on a form.
The combo box "cboCustSite", has a Row Source set to
Set the combo box properties:Code:SELECT DISTINCT CustSites.CustSiteID_PK, CustSites.SiteName FROM CustSites;
Bound Column = 1
Column count = 2
Column Widths = 0
This displays the "SiteName", but stores the "CustSiteID_PK" value! The user does not have to remember numbers!
Hmmm ok. I try to feed data in first and see how it goes! Thanks for your help!
My point is that the relationships with tables "ThailandPTTSites" and "MalaysiaEMEPMI" is the wrong way to go.
You can design the structures/relationships any way you want - it is your dB. But what do you do when you try to add "Brazil - Petrobas"???
Do you add another table???
With 2 or more tables , how do you select a site???
Just trying to point out potential problems....
Good luck with your project........
My point is that the relationships with tables "ThailandPTTSites" and "MalaysiaEMEPMI" is the wrong way to go.
You can design the structures/relationships any way you want - it is your dB. But what do you do when you try to add "Brazil - Petrobas"???
Do you add another table???
With 2 or more tables , how do you select a site???
Just trying to point out potential problems....
Good luck with your project........
no, i decided to follow your method. But I am feeding some data in to see if it is ok.
Hey just asking why I have issues with the Site Config Report (by Parts) (Previously named as MainPartsDetails form) with the field (Gearbox_model), (Driven_Model) and (Combustor_Type). They keep saying an syntext error but I copied the field heading into the tblMainParts. I even deleted the field and added it back to try but still an issue. I have PMed you the latest copy of the file.My point is that the relationships with tables "ThailandPTTSites" and "MalaysiaEMEPMI" is the wrong way to go.
You can design the structures/relationships any way you want - it is your dB. But what do you do when you try to add "Brazil - Petrobas"???
Do you add another table???
With 2 or more tables , how do you select a site???
Just trying to point out potential problems....
Good luck with your project........