Select * and Select Sometable.* are equivalent. If there is only ONE table, then they can be used interchangeably. If the query joins two or more tables, you need to be specific and use the second syntax.
Thank you!
Professionals do not make BE changes during work hours except in emergencies. You do it as a matter of course.
Negative. I don't do it as a matter of course. I don't do it at all if I can avoid it. And typically my shift starts and ends a bit later than everyone else, so I take the last hour of the day for me and say "I need exclusive access to the back end and then you can use it again." It works out almost the same as non-work hours. (It helps that there are only 8 users.)
Let me explain something - not that it really matters to the forum. I am not a professional. I was not hired to maintain this database. My day job for the company has nothing to do with the database or the database design or even coding. I was an end user of the database and someone said "Hey, it would be cool if the database could do this." I enjoy coding and I've made a lot of progress with the database and done some cool things with it and it has almost become a full-time job and they are okay with that - to a point. If I say "I have an idea that will save our users ten minutes per record, but it will take me two weeks to implement it." They are fine with that. If I say "I want to spend a couple of weeks getting the database stable so I don't have to keep everyone out and repair it every couple of weeks.", that's fine also. If I say "I really don't know how to do this, but let me spend two weeks reading forum threads, and then I think we need to normalize the database. I'm not sure how to do that, so it will take me another 4-6 weeks to learn and implement that. Then I'll have to test and verify it works. Then I'll have to spend a few days updating all the records that were changed while I was developing it. Then we'll have to retrain our users b/c it won't look or act like they were used to." - not so much.
I consider myself moderately skilled with Access and VBA. I'm good at finding code online and modifying it to do what we need. I'm not and never claim to be at the level of most of the users on this forum.
If you start by cleaning up the schema, the database engine will help with preventing some of the errors but only if you are willing to normalize and enforce RI and enforce the use of Forms only for data updates.
RI - Record Integrity ???
I do have two questions:
- You mentioned validation code and The_Doc_Man mentioned constraints. I'm not sure most of the data supports this - lots of it is text fields, but when is it implemented. In other words - there are for example 40-70 fields per record per table. Do I have code on the Form BeforeUpdate event to validate all 40 fields, or do I have code on each field to validate it and if it passed that I don't need to check again, or do I check both places.
- As I understand it, the main problem is I am not doing any true data validation. I think the validation rules would apply to either DS or Form View, so I'm not sure why input via DS view is an issue. (I do understand that DS view more obviously lends itself to right-click delete and right-click copy/paste entire records, but otherwise??? (It seems to me like users would be just as likely to corrupt the data by pasting into form view as into DS view, but I don't understand the issue.)
I don't think anyone has asked. Do you have Option Explicit defined for ALL your modules? You should if you don't. Then make sure that all variables are defined and the code always compiles without errors.
Yes Option Explicit is defined. I verify code compiles. I do a decompile/recompile before release.
That said, I'm finding some "rookie" mistakes:
- In repairing the backend, I noticed a LOT of my tables don't have a primary key DEFINED. They have an autonumber field named PrimaryKey - but they never got the little key icon next to it.
- I'm sure you know this, but Option Explicit isn't foolproof. For example, you can declare a Public Variable (Global Variable) in a module and declare the same variable in a subroutine of the same module and the variable is no longer Public. Also, the same thing happens if you declare the same variable as Public in two different modules. (And Option Explicit won't flag this - it will if you do it twice in the same module or subroutine.) I think I caught all of those b/c the database didn't work as I expected it to, but ...
You could get a list of your table designs and rename or obfuscate to remove company identify/proprietary info for sharing.
I do understand the company's concern, but there has to be some method/scheme if you''re going to get specific help/advice on a specific issue.
Yes - we have about 10 replies in this thread where I said code didn't work but I changed the name of the table to Names which doesn't have a dash in it b/c I was trying to obfuscate. I understand where you are coming from also.
Also - I mentioned to my supervisor - not about this forum, but in general:
- The company is fine if I ask on a forum for help, someone posts a code snippet and I use that in my code. (Although they'd be somewhat upset if the code I copied deleted all the files off the servers without my knowing it or sent the data to an adversary.)
- Officially, the company considers any code that I develop during working hours (even if I just fix an error in the code I downloaded) to be intellectual property of the company. (That's a general guideline, not a hard-and-fast rule).
I pointed out that it will be hard to get help in the future or at least make me unpopular on the forum if all I do is post "Your code worked great, thanks!" or "I found a typo in your code and I fixed it and got it working, but it's now IP of my corporation so I can't tell you what I fixed."
He more or less said that general items are okay - his opinion, though - meaning he probably won't defend what he says they try to fire me for it. So to paraphrase - where earlier I posted the code to search every field of every table for "###" is probably okay. If I posted code with our network server names in it, and/or code that the company uses that a competitor might find useful - possibly termination offense.
I think the underlying question(s) is Why did a record disappear? What caused the record to disappear? Do I have any backups I can review to see if other records have "disappeared"? Is there a pattern to this issue?
1 and 2 - I wish I knew. If I did, it wouldn't be happening. (If I knew where I was, I wouldn't be lost.)
3 - As I said initially, I export some key and relatively stable fields of each table weekly to Excel Reports and then use a program called Beyond Compare to check for differences in the reports - Particularly Excel Rows that were in the previous report and are not in the current one and that I don't specifically know of a reason for anyone deleting them. Excel Rows that are in the current report and were not in the previous ones and I don't remember adding, or records that clearly from the data don't belong in that table. But I only implemented that in November of 2022. Prior to that, we would only know a record was missing if someone searched for it and couldn't find it and I'm sure we lost some records that we don't know about.
4 - Hard to say. Typically the records are "active" - i.e. something viewed or changed on the day they disappeared, but not always. (It happens, but it would be unusual for "Hey, this record from 2005 is gone." But as I said, prior to last November, we wouldn't have known. The database was inconsistent, the BE was C&R. It opens again. All must be good.) Most often, it is a record that either the user that likes DS View or I was working in, but we're also probably the heaviest users of the DB, so that doesn't surprise me. Can't really verify, but it seems possible that it was records that we both might have been in - so not necessarily both editing at the same time, but perhaps one of us editing while the other user was viewing. Makes me wonder about record locking and I looked into that before but never really understood it.