Use One Form instead of Two (1 Viewer)

Keith

Registered User.
Local time
Today, 10:16
Joined
May 21, 2000
Messages
129
I have two buttons to open a form, one to add records the other to edit records. The 'Add New Record' button also writes some of the information to a second table. The 'Edit Record' button only updates a field in the second table if that field has changed. Both forms are identical but with different code behind them. I have been trying to achieve the same, using one form. I am having difficulty in running the code to add or update the record in the second table depending if the form is opened as Add New or Edit. I hope this makes sense. Could someone point me in the right direction, or should I stick to using two forms?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 10:16
Joined
Jul 9, 2003
Messages
16,282
>>>or should I stick to using two forms?<<<

No you're on the right track you want to reduce the number of forms any which way you can! That way you reduce the number of headaches. The only thing that bothers me is you mentioned a second table, it's usually a good idea to keep one form to One table. Once you start adding things to another table then, well it's not good practice. Not saying you shouldn't do it, I don't know your situation. But it usually points to some sort of design issue.
 

Keith

Registered User.
Local time
Today, 10:16
Joined
May 21, 2000
Messages
129
Tony, It is the db that I phoned you about when you were on holiday. I purchased a reservations Db that used a planner, which I do not need as it is only used for 4 days a year. The planner would not let you have two bookings for the same room at the same time. I am catering for two mates who want to share a twin room but be billed seperately
 

June7

AWF VIP
Local time
Today, 01:16
Joined
Mar 9, 2014
Messages
5,475
Still not clear why the 'second table'. Seems just need to change some table properties to allow duplicate values for room. Set a compound index to prevent duplicate room/client pair.
 

Keith

Registered User.
Local time
Today, 10:16
Joined
May 21, 2000
Messages
129
Still not clear why the 'second table'. Seems just need to change some table properties to allow duplicate values for room. Set a compound index to prevent duplicate room/client pair.

I defer to you and uncle gizmo and have decided to drop the second table.
 

June7

AWF VIP
Local time
Today, 01:16
Joined
Mar 9, 2014
Messages
5,475
Actually, should probably allow duplicate room/client pair for returning guests. Don't want duplicate room/client/date.
 

Users who are viewing this thread

Top Bottom