12-19-14, 10:18 #1Registered User
- Join Date
- Apr 2014
Unanswered: Get address to auto populate in a diffrent field
I have a very complex well at least for me database which you all helped me create by making code and such.. I say this cause I am not very good at the coding part of the program
So I have a probably easy question but just don't know how to do it.
I edited my entry form on this database so that the BUSINESS NAME/ RESIDENCE NAME is now a drop down. This will enable people to start typing and if there is a duplicate in there they can select that name so we don't have as many issues with various inputs on this field.
1 problem is they are not in alphabetical order which I would like to have happen. However the Fault Table which is were the info comes from must stay in order by date as it is now. (not sure if that matters)
What I would like to have happen then is,
1. If there is another alarm with the same name in the database they pick it and then it auto populates the address and TWS name (which is a Township Name) each alarm is its own record in the table so they all have different id numbers. As it is a yearly rotating database of information
2. The Person can then tab thru until they get to the other info they need to enter.
If the name is not in there they can enter all the data as they currently do.
Thanks in advance for the help. The database is attached and the info in here is test data
12-19-14, 12:36 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
1 problem is they are not in alphabetical order
you can alwasy set a sort order usign an ORDER BY clause
the way data is stored should not determine how data is presented.
..so ferinstance there is no need for the business name / residence to NOT be in alphabetic order.
the is no reason for the business nam,ke / residence NOT to display more than one item of data.
so why not display the company name AND part of the address in the combo box
or if you prefer use a lonked combo box where you select the organisation, search for matches and sisplay any addresses for that match in another combo which identifies the addrewss of propoerties for that organsiaion.
why you feel you need a separate table for envelopes and warning letters 'require' beats me.
that is all derived data.
what I'd suggest you do is:
have a table for organisations
arguably a table for addresses of organsiations
somewhere in the organsation or address tabel if you have one, a column whciuh identifies a letter needs to be sent AND an envelope (label?) needs printing
copying data from one table to another table to anoter table is at best a waste of time and effort and at worst will lead to the data becoming out of data or suspect. the whole ethos behind computerising such things is to reduce the amount of duplication and list maintaining. store what you need not what the manural processes made you do.
likewise you have an active fault table and an archive fault table.. why?
there is nothign stopping you havign a column which indicates / defines when a fault becimes out of date/up for 'archiving', when it does the data remains int he table but is hidden form current display.
that means you have one form dispalying faults, but based on a setting in that form you display all faults, current or old faults. one form with a but more effort covers two forms in your current design.
equally what happens if say someone iontrodcues a new rule that faults over the last 3 years are now to be regarded as warnings... in your current model you have to shunt records backwards and forwardds MANUALLY to handle that. storing in the same table determined by a setting means that carefully designed you do not require any developer invovlment in the change its down to the users and how they deal with 'their' data
on the face of it I can see little or no demonstration of good relational db design practice (stuff like normalisation) why does that matter. well what happens if, say a trooper changes name, . equally what happens if there is a typo introduced however (either by users or inadvertent data editing. bear in mind Trooper BERETSKY amay be mispelled as BERETSKI, or even BERETSKY, Fred. by not consttrainign things such as thius you leave yourself wide opne to data errors or requiring manuaul interventiuon to realise that Trooper McGuiness is the same as Trooper MacGuiness
arguably for this application the address is more important that the organsiation as the fault is raised at an address but the organisation occupying that property may change.I'd rather be riding on the Tiger 800 or the Norton
12-19-14, 13:08 #3Registered User
- Join Date
- Apr 2014
ok well like I said I am new and this database was a miss mash of people like yourself helping me put it together.
The Trooper name all come out of one table called Personel and are not editable by the end user I think.
The reason for the archive was that is the only way I knew how to do it and it gets all those alarms out of my field of view
IF you know how to wright the code so that I can generate the letter and the envelope at the same time I agree that would be better but again I don't know how to do that so would need your help with the code as a novice who does not really know anything.
I understand the sort for the field however when I attempted that the sort buttons were grayed out so I could not so thought there might be another way to get that or an issue with it.
The reason we do the fields separate was on the advice of the 2 people who helped right the code for citations and warning letter queries I like it because I run a double check off address once in a while.. Due to the uniqness of the Business name that is the primary item searched in all queries because in our state we have many different business names under one address so the name is more unique then the address. These citations and letters are also specific to the business that occupies the space not to the property owner.
Having said all this is there a solution to the type in the business name and have the address field and Tws field populate from an previous matching alarm or not really cause of the way this is set up.
01-06-15, 06:09 #4Registered User
- Join Date
- Apr 2014
Guess you scared away anyone who would want to help gave me a good lashing here