I have two tables, one consists of company info like name and phone
number.
Another table where I have to fill in the contact persons. Part of the
form is to choose the company he works for (From a list box). Then,
after I choosed the conpany, I want to have auto filled in the field
phone number from the 1st table. But, and that's why i want to have it
archieved in the table (so no redundancy): I want that the field
phonenumber can be editted as the company phone number is not always
the direct number from the contact person.
The method should be like:
Use a ComboBox for entering the Company and include a hidden column
that has the
phone number. In the AfterUpdate event of the ComboBox have code...
Me.ContactPhone = Me.Company.Column(n)
....where 'n' is the zero based position of the hidden phone number
column in the
ComboBox.
Now, I am halfway in that procedure.
My question:
How about the setting in the ContactPhone field.
Must it be like
Me.ContactPhone = Len(me!ContactPhone)
in GotFocus or BeforeUpdate?
Bart 10 1658
"AA Arens" <ba***********@gmail.com> wrote in
news:11**********************@i40g2000cwc.googlegr oups.com: I have two tables, one consists of company info like name and phone number. Another table where I have to fill in the contact persons. Part of the form is to choose the company he works for (From a list box). Then, after I choosed the conpany, I want to have auto filled in the field phone number from the 1st table. But, and that's why i want to have it archieved in the table (so no redundancy): I want that the field phonenumber can be editted as the company phone number is not always the direct number from the contact person.
The method should be like: Use a ComboBox for entering the Company and include a hidden column that has the phone number. In the AfterUpdate event of the ComboBox have code... Me.ContactPhone = Me.Company.Column(n) ...where 'n' is the zero based position of the hidden phone number column in the ComboBox.
Now, I am halfway in that procedure.
My question: How about the setting in the ContactPhone field. Must it be like Me.ContactPhone = Len(me!ContactPhone) in GotFocus or BeforeUpdate?
You don't need anything in the ContactPhone if you wish to allow
it to be changed.
If you wish to prevent changing it when the company changes, and
I cannot see why you would need to do that, just put a condition
on your update in the combobox After Update event.
Company_AfterUpdate
IF len(me.Contactphone) & "" = 0 Then
Me.ContactPhone = Me.Company.Column(n)
ENDIF
--
Bob Quintal
PA is y I've altered my email address.
Bob Quintal wrote: You don't need anything in the ContactPhone if you wish to allow it to be changed.
If you wish to prevent changing it when the company changes, and I cannot see why you would need to do that, just put a condition on your update in the combobox After Update event.
Company_AfterUpdate IF len(me.Contactphone) & "" = 0 Then Me.ContactPhone = Me.Company.Column(n) ENDIF
A minor quibble, Bob.
IF len(me.Contactphone) & "" = 0 Then
I think that the concatenation should be inside the parentheses.
IF len(me.Contactphone & "") = 0 Then
--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Randy Harris <pl****@send.no.spam> wrote in
news:Iz******************@newssvr25.news.prodigy.n et: Bob Quintal wrote: You don't need anything in the ContactPhone if you wish to allow it to be changed.
If you wish to prevent changing it when the company changes, and I cannot see why you would need to do that, just put a condition on your update in the combobox After Update event.
Company_AfterUpdate IF len(me.Contactphone) & "" = 0 Then Me.ContactPhone = Me.Company.Column(n) ENDIF
A minor quibble, Bob.
IF len(me.Contactphone) & "" = 0 Then
I think that the concatenation should be inside the parentheses.
IF len(me.Contactphone & "") = 0 Then
I know that the concatenation should be inside the parentheses,
from debugging similar errors I keep making.
--
Bob Quintal
PA is y I've altered my email address.
It works. I even can freely fill in the phone number if it differs from
the comopany number.
The only problem that occurs is that the comopany ID is now also added
to the comoany table. That;s not what i want.
How come it occurs?
Bart
"AA Arens" <ba***********@gmail.com> wrote in
news:11**********************@z34g2000cwc.googlegr oups.com: It works. I even can freely fill in the phone number if it differs from the comopany number. The only problem that occurs is that the comopany ID is now also added to the comoany table. That;s not what i want.
How come it occurs?
Bart
Do you mean that the company ID is added again to the company
table? This is strange, because company ID should be primary key to
the company table and that would prevent duplicates.
Or do you mean it's putting the company ID in the company phone
field?
Not enough information to diagnose the problem..
--
Bob Quintal
PA is y I've altered my email address.
Sorry, my question was not built perfectly.
I do have two tables:
Table 1 = Form 1: Company - co. related fields
Table 2 = Form 2: Customer- contact related fields.
My first message (all above) was all about the 2nd table/form. Now,
the problem I mentioned in my first message is solved.
This is my working solution of the first problem:
Private Sub Combo78_AfterUpdate()
Me.WorkPhone = Me.Combo78.Column(2)
If Len(Me.WorkPhone & "") = 0 Then
Me.WorkPhone = Me.Combo78.Column(2)
End If
Me.FaxNumber = Me.Combo78.Column(3)
If Len(Me.FaxNumber & "") = 0 Then
Me.FaxNumber = Me.Combo78.Column(3)
End If
Control Source combo box: CompanyName
And this is the Row source of the combo box:
SELECT [tblClients].[CustomerID], [tblClients].[CompanyName],
[tblClients].[PhoneNumber], [tblClients].[FaxNumber] FROM [tblClients]
ORDER BY [CompanyName];
But:
The contact ID, that is the number of the customer of table 2/form 2,
is added in the companyname column of the 1st table.
How?
I can't see why there is an order to add a record in the 1st table from
the 2nd form.
"AA Arens" <ba***********@gmail.com> wrote in
news:11**********************@i39g2000cwa.googlegr oups.com: Sorry, my question was not built perfectly.
I do have two tables:
Table 1 = Form 1: Company - co. related fields Table 2 = Form 2: Customer- contact related fields.
My first message (all above) was all about the 2nd table/form. Now, the problem I mentioned in my first message is solved.
This is my working solution of the first problem:
Private Sub Combo78_AfterUpdate() Me.WorkPhone = Me.Combo78.Column(2) If Len(Me.WorkPhone & "") = 0 Then Me.WorkPhone = Me.Combo78.Column(2) End If Me.FaxNumber = Me.Combo78.Column(3) If Len(Me.FaxNumber & "") = 0 Then Me.FaxNumber = Me.Combo78.Column(3) End If
Control Source combo box: CompanyName
And this is the Row source of the combo box: SELECT [tblClients].[CustomerID], [tblClients].[CompanyName], [tblClients].[PhoneNumber], [tblClients].[FaxNumber] FROM [tblClients] ORDER BY [CompanyName];
But: The contact ID, that is the number of the customer of table 2/form 2, is added in the companyname column of the 1st table. How?
I can't see why there is an order to add a record in the 1st table from the 2nd form.
just guessing here, but might your combobox be bound? to the
field in table1?
--
Bob Quintal
PA is y I've altered my email address.
Rob,
When I set up the combo box I choosed the data from Table 1 (field:
company name) as this tables included the company name, just to have
the combo list filled with this data.
What should I do? Customer ID?
Bart
"AA Arens" <ba***********@gmail.com> wrote in
news:11**********************@j33g2000cwa.googlegr oups.com: Rob,
When I set up the combo box I choosed the data from Table 1 (field: company name) as this tables included the company name, just to have the combo list filled with this data. What should I do? Customer ID?
Bart
leave the combo bound to table 2, not table 1
--
Bob Quintal
PA is y I've altered my email address.
Thanks, Rob. That was the problem. I let the CustomerID data fill in in
the customerID column of table 2
Bob Quintal wrote: "AA Arens" <ba***********@gmail.com> wrote in news:11**********************@j33g2000cwa.googlegr oups.com:
Rob,
When I set up the combo box I choosed the data from Table 1 (field: company name) as this tables included the company name, just to have the combo list filled with this data. What should I do? Customer ID?
Bart leave the combo bound to table 2, not table 1 -- Bob Quintal
PA is y I've altered my email address. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marco Simone |
last post by:
Hi,
What is your opinion about using Lookup field in table. I would like to use
lookup field in table 1, so that I can choose data in combo box from table
2.
Is this good design of database?
...
|
by: A.J.M. van Rijthoven |
last post by:
I have a table instrumenten (INSID Instrumentname, CATID), a table
Categorie (CATID, Categorydescription), Netten (NETID, description of
net) and a table (kpltblinstrument) that links the...
|
by: astro |
last post by:
Anyone have suggestions on where to troubleshoot this error?
Background:
-Access 2k v. 9.0.6926 sp3
- front and backend on production server (wiindows 2k)
-accessed via Citrix
-front-end is...
|
by: Pam Ammond |
last post by:
I need the code to update the database when Save is clicked and a text field
has changed. This should be very easy since I used Microsoft's wizards for
the OleDBAdapter and OleDBConnection, and...
|
by: AA Arens |
last post by:
I have two tables, one consists of company info like name and phone
number.
Another table where I have to fill in the contact persons. Part of the
form is to choose the company he works for (From...
| |
by: AA Arens |
last post by:
Hi I do have a products table and products-parts table in my Access
2003 database and log all services into a form.
I do have at least the following two combo boxes on my form:
- Choose...
|
by: Ecohouse |
last post by:
I have a main form with two subforms. The first subform has the child
link to the main form identity key.
subform1 - Master Field: SK
Child Field: TrainingMasterSK
The second subform has a...
|
by: gmazza via AccessMonster.com |
last post by:
Hi there,
I am trying to run a report using a parameter for where the user chooses a
month from a combo box. Then on the report, I want it to compare the month to
a date field and choose only...
|
by: VUNETdotUS |
last post by:
Firefox showed me a security error when I was copying a value of file
field object into new DOM created input file field. Can I do something
about it?
Thanks.
|
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,...
|
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...
| |
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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,...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |