473,395 Members | 1,885 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,395 software developers and data experts.

Form sub-form problem

Hello all, I’m a newbie so please forgive me if my description of the problem is not clear. Here goes. I’m developing a new database for my contracting company. I have a form with a sub form. The main-form has all the customer names, addresses and phone numbers and the sub-form has the descriptions and the cost of each service.

I may need to generate 3 different records per year for one single customer. When I start typing in the CustomerID for a new record the last and only record for that customer appears in the detail section. I’m in a position where I can only enter one customer name and one detailed section _____________period. I’m sure the problem lies in properties but I can’t figure it out. I tried it out with the wizard and drag and drop and it still won’t work.

Regards,

Steve
Mar 24 '07 #1
10 1260
nico5038
3,080 Expert 2GB
Do you have a tblDescription table with the KeyField of the Company table ?

Nic;o)
Mar 24 '07 #2
Hello Nico5038

Yes as a matter of fact I do. I used the phone number as the unique identifier for customer's names and addresses and included that very phone number field in the discription table. The discription form is in datasheet view by the way.


Regards

Steve
Mar 25 '07 #3
nico5038
3,080 Expert 2GB
I'ts better to use an autonumber as the ("meaningless") ID for your clients as a phonenumber can change.
For the additional records you can use that ID as the so-called "ForeignKey".
The additional records will have to be in a table e.g. named tblClientService.
Now this table will hold the ClientID and the ServiceID. When defining this table select the ClientID and press the "Lookup" tab. Change the textfield into a Lookup from a table and "connect" the field to the tblClient. Do the same for the ServiceID field that can be connected to the tblService.

Now add a ServiceDate field to be able to separate the rows from this table and have multiple same Services linked to a Client. Finally select all three fields (ClientID, ServiceID and ServiceDate) and press the "Key" button to indicate that these form the unique identifier.

Now you can define a mainform for the client and add the tblClientServiceas the subform for the additional rows.

Getting the idea ?

Nic;o)
Mar 25 '07 #4
Hi nico5038,

Thanks for the response. I'm going to need some time to digest that. I'm a real newbi to this. If I do what you suggest I'm sure it will work.

regards,

Steve
Mar 25 '07 #5
Hello nico5038,

Is this what you have in mind?

Two tables for a service database

CustomersTable

ClientID “autonumber”
FirstName
LastName
Address
City
Prov
PostalCode
PhoneNumber


ClientServiceTable

ServiceID “Lookup” connect to CustomersTable “key”
ClientID “Lookup” connect to CustomersTable “key”
Discription
Cost
ServiceDate “key”



Regards
Mar 25 '07 #6
nico5038
3,080 Expert 2GB
No, I guess the same service will be applied to multiple clients.
Thus it's best to have a separate tblService that can hold the name and price, etc.

Getting the idea ?

Nic;o)
Mar 25 '07 #7
Hello again nico5038,

Not sure I understand what your last post was referring to. Could you rephrase?
Also not sure what the term "ForeignKey" means, can't find it's definition in the help section of Access2000.

Having said all that do the two table I describled in my last post look OK to you?


Regards,

Steve
Mar 26 '07 #8
nico5038
3,080 Expert 2GB
The tables are OK, but you need a third table for the Services.

ClientServiceTable

ServiceID “Lookup” connect to CustomersTable “key”
ClientID “Lookup” connect to ServicesTable “key” <===== new table
Discription
Cost
ServiceDate “key”

Both the "connect to" fields are called "Foreign keys" as they are the primary key of another table.

Nic;o)
Mar 26 '07 #9
Hello again nico5038

I’m sorry for being such a pain but there must be some elementary step I’m just not getting. If I’m to understand you correctly I’m to create another table which is a mirror copy of my already established ClientServiceTable. If I do that I will have 2 service tables.

I’ve taken the liberty of uploading to my website two tables from a previous post that we discussed. Before pressing on I was wondering if you would just look at them and tell me if the keys are correct. The link is at http://stevecale.com/database

Being new to this forum I wasn’t sure how far one goes in getting help from the moderators or senior programmers from this forum.

Just in a nutshell in case I haven’t mentioned it A few years ago I built a flat database with 1 table for my contracting company. I’m a contractor not a programmer, so I found it easy to do it this way. I know now that I have really limited the functionality of this database. I’ve got customer names addresses and phone numbers at the top of the form and below that there are 14 description fields and 14 cost fields and totals. It’s clumsy but it works.

So with this new design I’m try to get the top part of a newly designed database to refreshed the below sub-form. Have not been successful. If I enter a customer which is already in the database it will pull up the last and only record in the sub-form. In other words if I want to enter a new project for an already established customer it won’t let me do it. It keeps pulling up the last record and only record in the sub-form.


Regards,

Steve
Mar 26 '07 #10
nico5038
3,080 Expert 2GB
Hello again nico5038

I’m sorry for being such a pain but there must be some elementary step I’m just not getting. If I’m to understand you correctly I’m to create another table which is a mirror copy of my already established ClientServiceTable. If I do that I will have 2 service tables.

I’ve taken the liberty of uploading to my website two tables from a previous post that we discussed. Before pressing on I was wondering if you would just look at them and tell me if the keys are correct. The link is at http://stevecale.com/database

Being new to this forum I wasn’t sure how far one goes in getting help from the moderators or senior programmers from this forum.

Just in a nutshell in case I haven’t mentioned it A few years ago I built a flat database with 1 table for my contracting company. I’m a contractor not a programmer, so I found it easy to do it this way. I know now that I have really limited the functionality of this database. I’ve got customer names addresses and phone numbers at the top of the form and below that there are 14 description fields and 14 cost fields and totals. It’s clumsy but it works.

So with this new design I’m try to get the top part of a newly designed database to refreshed the below sub-form. Have not been successful. If I enter a customer which is already in the database it will pull up the last and only record in the sub-form. In other words if I want to enter a new project for an already established customer it won’t let me do it. It keeps pulling up the last record and only record in the sub-form.


Regards,

Steve

Hi Steve,

You can never be a pain, it's only me not being able to judge your level of expertise :-)
I'll help as long as it's not clear, so keep posting :-)

The idea of the separate tblService is the same as for a tblProducts in an Order database.
When defining an order you're combining the data of a Client to one or more Order details. Each OrderDetail will contain a product, quantity and price.
The Product will be extracted from a tblProduct as multiple customers can order the same product.

Same goes for your services. Each service can have a different set f properties (Price, Duration, etc.) and the same client can use it overtime multiple times.
To ease the dataentry you use in the tblClientService only the ID of the service. The other Service properties we can always get by joining tables in a query.

Bit clearer now ?

Nic;o)
Mar 26 '07 #11

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

Similar topics

2
by: tshad | last post by:
I have an example I copied from "programming asp.net" (o'reilly) and can't seem to get the Sub (writefile) to execute. It displays all the response.write lines that are called directly, but not...
4
by: Terry | last post by:
The following code (VB6) automatically sets ticks or null values for Check Boxes: 'Pass' and/or 'Resit', depending on the data entered in the 'ModuleID' and 'Mark' Text Boxes. 'ModuleID' is a...
3
by: Kathy Burke | last post by:
Hi, I'm tired, so this question may be silly. I have a fairly long sub procedure. Based on one condition, I load another sub with the following: If Session("GRN") = "complete" Then txtScan.Text...
3
by: Fabio | last post by:
Hi all, Whats the real difference between Overloads and Shadows in a Sub???? Thanks in advance, Fabop
10
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal...
3
by: andreas | last post by:
Hi, Is it possible to stop a sub in the middle waiting for a button clic to go further ? F.e. dim blnToStop as boolean private sub test ....... .......
12
by: Ron | last post by:
Greetings, I am trying to understand the rational for Raising Events instead of just calling a sub. Could someone explain the difference between the following 2 scenarios? Why would I want to...
7
by: ILCSP | last post by:
Hi, I'm using VB.Net (2003) and I have a question. Does anyone knows how to call a procedure using a variable? The variable will be equal to the name of the procedure. for example, if I have...
5
by: Sharon | last post by:
Hi all. To prevent access to a sub system internal types, is it necessary to create the sub system in a different project, and use the internal access level? Or is there another way that will...
6
by: Bob | last post by:
Hi, I found this code here below (about cartitems and shoppingcart) and I have two questions about sub New(). In the first class CartItem, there is two times sub New(): Public Sub New() End...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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
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...
0
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...
0
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,...

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.