473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Form not working

I have got myself into a total muddle over this and not sure where to
turn.

I have 2 tables;
Customers - which has a primary key of customerID
Appointments - which has a primary key of AppID

I have created a form to enter appointments made (with customers).
This is based on the two tables above (one to many relationship exists
between the account ID fields)

The idea is that AppID is an autonumber filled in when I open the form.
Then the user selects the outer postcode of the customer) from a combo.
This populates a list of customers in a second combo and the user
selects the customer the appointment is with. These details autofill
fields on the form with the customer address details etc.

However if I do not have an AccountID field on the form it does not
work. If I do have an accountID field (populated automatically by the
selction from combobox 2) I get an error saying;

"Te changes you requested to the table were not successful because they
would create duplicate values in the index, primary key or
relationship."

I don't know whether this is because the db is presuming I am trying to
re-add the account to the accounts table. Or something else! I don't
know how to fix this - I am not trying to add the account just view the
details of the account and record in the appointments table that I have
made an appointment there!

Thanks.

Dec 4 '06 #1
4 1294
I,m guessing that the second combo box is bound to AccountID or is it
CustomerID.
This should not be bound and a bit of code written After update.
Assume you rename the Combo to CustomerIDRelay
Assume you have another control on the form called CustomerID and bound to
CustomerID

Then you need
Sub CustomerID_AfterUpdate
DoCmd.GotoControl "CustomerID"
DoCmd.FindRecord CustomerIDRelay
End Sub

HTH

Phil

"keri" <ke*********@diageo.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
>I have got myself into a total muddle over this and not sure where to
turn.

I have 2 tables;
Customers - which has a primary key of customerID
Appointments - which has a primary key of AppID

I have created a form to enter appointments made (with customers).
This is based on the two tables above (one to many relationship exists
between the account ID fields)

The idea is that AppID is an autonumber filled in when I open the form.
Then the user selects the outer postcode of the customer) from a combo.
This populates a list of customers in a second combo and the user
selects the customer the appointment is with. These details autofill
fields on the form with the customer address details etc.

However if I do not have an AccountID field on the form it does not
work. If I do have an accountID field (populated automatically by the
selction from combobox 2) I get an error saying;

"Te changes you requested to the table were not successful because they
would create duplicate values in the index, primary key or
relationship."

I don't know whether this is because the db is presuming I am trying to
re-add the account to the accounts table. Or something else! I don't
know how to fix this - I am not trying to add the account just view the
details of the account and record in the appointments table that I have
made an appointment there!

Thanks.

Dec 4 '06 #2
Thanks - i've now solved this problem and found another huge one!
I thought my whole form was working but NO that would be too simple!

I can fill in the whole form and at the bottom of page 2 I have two
buttons
- Add another appointment - save and open new record and go to page 1
- Finished entering appointments - save and close

If I click "finished entering appointments" the appointment details are
saved to the table fine. However when I go back into the form my 2nd
combo box doesn't work (it is blank) and the customer details (supposed
to be populated by the 2nd combo box) show the details from the saved
appointment. I can get the form working again by clicking in and out of
design view, yet when I enter another call after doing this it
overwrites the first call stored in the table.

Or;

If I click "add another appointment" I am taken back to the beginning
of a new form page fine. However when I start using the combo boxes to
select the customer details the 1st combo box changes the record back
to the 1st saved record when use it. (If i continued to fill in the
form and save this would overwrite the first record stored in the
table). When this happens I can adjust the record number back to "2"
and then I can save a second record.

But none of this is supposed to happen! Any ideas?

Dec 4 '06 #3

I seem better at writing problems into my database than writing
solutions. Sorry!

I have now found that no matter what I enter in my first combo box
(outer postcode area eg DL1) the combo box that is populated from a
query based on the selection in the first combo box does not change.
Instead it only shows me customer details based on the entry in the
first combo box of the last saved record!

I'm trying everything I can to solve this but only seem to be making it
worse. I am so so thankful for all of the help on here, so thanks guys.

Dec 4 '06 #4
On 4 Dec 2006 11:28:34 -0800, "keri" <ke*********@diageo.comwrote:
>
I seem better at writing problems into my database than writing
solutions. Sorry!

I have now found that no matter what I enter in my first combo box
(outer postcode area eg DL1) the combo box that is populated from a
query based on the selection in the first combo box does not change.
Instead it only shows me customer details based on the entry in the
first combo box of the last saved record!

I'm trying everything I can to solve this but only seem to be making it
worse. I am so so thankful for all of the help on here, so thanks guys.
You will need to requery your 2nd combo after the first combo has been updated,
in order to populate the 2nd combo with the related records.

In the AfterUpdate event of the 1st combo put -

Me.NameOf2ndCombo.Requery
Wayne Gillespie
Gosford NSW Australia
Dec 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
8
by: CJack | last post by:
hy, I have an mdi application, i create a child form and I want to know when a button is pressed while that child form is loaded. I have this code: private void frmTestBaby_KeyUp(object sender,...
4
by: Michael | last post by:
Hi Everyone, I'm hoping someone out there can give me some guidance. I'm currenlty using VS2005 and the other day the Form Wizzard stopped working. What I mean, is that the wizzard no longer...
14
by: Galen Somerville | last post by:
My current screen resolution is set to 1024 x 768. My form size always comes up as 1032 x 748. I have tried the help sample ' Retrieve the working rectangle from the Screen class ' using the...
13
by: deko | last post by:
I have a basic feedback form with a submit button. After the "send" button is clicked, I want the user to be redirected to a different page that says "Your message has been sent." How do I do...
6
by: Harshpandya | last post by:
Hi all, I am working on the form in which you fill out the whole PHP form and e mail that details to someone. It is working fine. But now i want to send the same form to be sent to different...
0
by: asad56 | last post by:
I am workin with a superstore managment project. I connect Access database with main form . Then it work properly. But now I connect same database with another table or field in another form which is...
7
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
11
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.