Tech Support Guy banner
Status
Not open for further replies.

Access database problem

1K views 6 replies 3 participants last post by  berum 
#1 ·
In my database program the user has the option to delete clients from a list or add new ones. This works fine unless all clients are deleted and the database becomes empty. Once this happens, the user is still able to add new clients to the empty database. However, back in the forms area, it will not allow new data to be entered in the fields for the new clients.
 
#2 ·
What IS available when you open the form, Berum? If you mean that they are unable to enter ADDITIONAL data into fields of existing records, then go to the Form properties and make sure that Data Entry doesn't say YES, which means you can't use that form to EDIT records, only to add new ones.
 
#3 ·
I looked, and that property is set correctly. Here's another weird thing: If I delete all but one or two records, the same thing happens... I can't enter new information on the form for new clients I add later. However, I can still enter and modify data on the one or two records I didn't delete. I'm not sure, but I think this may have something to do with my actions affecting the corresponding table. I have the name category set as the primary key. Is that getting messed up by me adding and deleting records from the forms? I have no idea. Another thing I find puzzling is that when I had a full list of clients and only deleted a few, everything worked fine; even with new clients I added afterward. It was not until I deleted the majority of the list (all but two clients) that I had this problem. Please let me know if my description of the problem makes no sense whatsoever. Thanks for your help.
 
#4 ·
I'm a little stumped on this one. Can you maybe give some more info on the setup of
your forms/tables/SQL queries?

I have seen similar problems when a forms query or a control on a form with a query
reference some other control on the form. If that control contains no data then the
form/control that references it might get 'stuck.' I'm not sure though that this is your
problem.

As a general tip, use a number field as your Primary key. Give each customer a
number (or autonumber) and use that number as the PK. If you use a Name field
(assuming it contains the text of the name and not a reference number) you are
asking for trouble. A text PK is harder to use as a reference and wastes DB space.
 
#5 ·
You are correct... The page content is linked to a field on another page. Assuming that the "empty" information makes the record get "stuck," I went in and edited the referenced table to have default values for the various fields for new records. This prevented the new records from being empty. This appears to have solved the problem. However, I read what you said about the PK being numeric. For some reason, I changed that early on because there were other problems. I don't really remember why. In your opinion, can I safely assume that I have fixed this problem by inserting the default values? Thanks for the reply!
 
#6 ·
I guess the only true way to find out is to experiment. Unfortunately, problems of this nature can be very complicated and without seeing your setup it's impossible for me to tell if all possible scenarios are accounted for.

In general, I try to solve this type of problem by writing code that tests for an empty table before the form opens. If it finds an empty table it goes straight into Add New mode. You would have to first make sure that nothing is linked to the Add New form unless the possibility of a blank form is taken care of. I can't get too much more specific than that though without more details about your situation.

Setting default values may or may not help depending on what was causing the problem. If you can set up default values that make sense and solve the problem then that might be the best route for you. Again, the only way to tell for sure is to experiment. (Or to bang your head against the wall until every possible scenario has been shaken out!
)

As far as the PK goes, think about this. What do you do if you have two customers with the same name? Remember, The PK must be unique!
 
#7 ·
I have protected that field from accepting duplicate data because of the PK. The only problem will be having 2 John Doe's at one time. No big deal, really. I'll just add an initial or something. This program is going to organize data for only 50 to 75 people at a time, so I don't anticipate any real problems. I do appreciate the information. I've tried beating my head against the wall and the problems seemed to continue. That's why I sought out a bulletin board with gracious gurus.

Take Care... Thanks again, YSB. (you too Dreamboat)
 
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top