473,654 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1313
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_Afte rUpdate
DoCmd.GotoContr ol "CustomerID "
DoCmd.FindRecor d CustomerIDRelay
End Sub

HTH

Phil

"keri" <ke*********@di ageo.comwrote in message
news:11******** **************@ f1g2000cwa.goog legroups.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*********@di ageo.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.NameOf2ndCom bo.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
2880
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 it took to go to a record was very slow. The go to mechanism was a box that the user typed the index value into a combo box, with very simple code attached: with me.RecordsetClone .FindFirst " = " & me.cboGoTo If Not .NoMatch Then Me.Bookmark...
25
10219
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 data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
8
4928
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, System.EventArgs e) { MessageBox.Show("keyboard button pressed!"); } Following is the code to load the frmTestBaby
4
1686
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 creates the code in the "Windows Form Designer generated code" section. As a matter a fact, if I add a new form to the project, that section is not even there. The only code that you will see is: Public Class Form2 End Class
14
3411
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 PrimaryScreen and the WorkingArea properties. Dim workingRectangle As System.Drawing.Rectangle = _ Screen.PrimaryScreen.WorkingArea ' Set the size of the form slightly less than size of
13
69994
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 this? I've tried using: header("Location:http://www.mysite.com/send-confirm.php");
6
6888
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 people and user should be able choose the check boxes to whom they want to send e mail to. I write some code simple If else conditions but i think i am making some mistakes. Because when i tried - it is not sending them e mails. Here is my code. I...
0
1964
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 child of main form not working. Main form stil working but when try to open child a message show as Please select a valid SQL statement as "Select", "Delet" or "Updat" I am working with Access . I connect database in...
7
9355
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 display the Windows form. The form is being displayed but the command only returns when the form is closed. I want the command line to return immediately, leaving the form displayed.
11
2264
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 6.something I think and running as a service, Using NoteTab Pro as an IDE (works well). If you need more, just ask. In one functioning form:
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.