473,326 Members | 2,061 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,326 software developers and data experts.

how to autofill data fields when ticking a checkbox

I am new on Access and currently use access 2003. I have read a few other posts already for other problems I have had and they have been very helpful, so I thought I'd post my own question as I couldn't find it in the posts..


I have two separate related tables, Contact and Company, and a form "add new contact". Contact has fields such as: ContactID, First Name, Surname, Address, City, Company ID, phone, etc. and a Main Contact field(Yes/No field).
Company has fields like:CompanyID, CompanyName, Address, City, Phone, etc, and a Main Contact field (text field).

On my "add new contact" form and "update contact" form, I have a checkbox (check if contact is main company contact).
What I would like to do is, when the checkbox is ticked, that the first name and surname of the contact on that form is automatically set into the company table under the Main Contact field.

I have tried creating a separate table called "Main Contact" with MainContactID for example, and etc. but the table will not update. I'm not sure if I am doing this the right way...

It's important for my database as each company has many contacts, and we need to identify on the company form which is the main contact.

Many thanks for your help in advance!!
Elodie
Apr 14 '10 #1
3 2674
NeoPa
32,556 Expert Mod 16PB
Maintaining your main contact information in two separate places (Contact and Customer tables) is not Normalised (See Normalisation and Table structures). This is not a good thing and I'd advise you to restructure to avoid this.

That said, looking specifically at the Contact table, you would need code to handle the situation whenever a contact is changed from or to being the Main Contact. When one is changed to Main Contact you would need code to remove this setting from whichever one previously had it set. Resetting this value should only be allowed if you have some valid logic that can determine which should be promoted in its stead. This logic would also need to be implemented in code in that case.

Importantly, in all scenarios, the first contact should always be forced to be the Main one.
Apr 15 '10 #2
Hi and thanks for your reply.

however I am not sure you have understood my question well. I do not have a Customer table but COMPANY table, and the details of the contacts are NOT stored in the company table but contact table. these two tables are linked by companyID (primary key of Company table).

In any case, I have reseolved my problem in another way

cheers
Apr 15 '10 #3
NeoPa
32,556 Expert Mod 16PB
I'm pleased you've found a way to resolve your problem, nevertheless, my earlier advice, with the proviso that I used the wrong name for your table - a pretty minor inconsistency in the circumstances - for which I apologise, still holds.

Quote=emichelFACCI
What I would like to do is, when the checkbox is ticked, that the first name and surname of the contact on that form is automatically set into the company table under the Main Contact field.
End Quote

Assuming the quoted text is still true, then your more recent statement that :

Quote=emichelFACCI
the details of the contacts are NOT stored in the company table
End Quote

seems to be contradictory. I'm not sure where that leaves us. I would just say if the former is true then this is non-normalised data. If the latter is true, then you clearly don't have that problem.

Lastly, it would be interesting to see what your solution is, bearing in mind the question is posted in a public forum. If you have the time to post it that would be appreciated.
Apr 16 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Chris Sharman | last post by:
I'd like to design my pages to work cooperatively with browser autofill features. I've loked around, but can't find any good documentation on supported/unsupported field names...
1
by: shortbackandsides.no | last post by:
I'm having a lot of difficulty trying to persuade the Google toolbar autofill to act consistently, for example ======================= <html><head> <title>autofill test</title> </head><body>...
0
by: David Portabella | last post by:
Hello, I am a doing a survey about Autofill Web Forms softwares. Usually, they all collect information of the user once during the set-up phase (user knowledge base). Then, when the user...
1
by: Nick J | last post by:
Hi, I remember at one point access would autofill a text box when filtering by form, Like for example as I would type it would come up with matching records, similar to AutoComplete in Internet...
2
by: LCalaway | last post by:
Happy 4th, all How do you turn off the following type of autofill: Example: I have created a table with four text fields. When entering numeric data in these fields, by the third field, a...
4
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET...
4
by: HTS | last post by:
I have written a membership database application (PHP + mySQL) and need to prevent autofill from filling in fields in a member record edit form. I know I can turn off autoFill in my browsers, I...
5
by: Sherry | last post by:
Is there a way to automatically, or by using say a function key, call/paste into a current table or query's field the same value entered for the same field in the immediately preceeding record,...
19
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect...
8
by: tess | last post by:
I have: table 1 - tblLeadInfo which includes a salesman ID field table 2 - tbllkpSalesman with all zips in the state and a Salesman assigned to that area. I have a form based on table #1 When...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.