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

Subform - create list of records

I was wondering if what I'm trying to do in Access XP and 2003 is possible. I've looked at countless templates and samples and havn't seen anything like what I want to do to be able to construct it. I've tried manipulating queries, relationships different table joins but to no avail. I'm only a beginner in VBA and know little SQL, I would be truly gratefull if someone can please shed some light on the below.



I've been creating a preventitive fleet maintenance database in access and want to make some changes that will make the database more flexible.

What I have is a main form which has the following main fields from the tblWorkOrder; WorkOrderID, FleetID, StartDate, FinishDate, Odometer, and ServiceTypeID.

Within this I have a subform in datasheet view (tblServiceItems, fields; ServiceItemID, ServiceDescription, ServiceCompleted(checkbox)) and this lists all the service items that belong to the ServiceTypeID in the main form.



I have another table called tblServiceDetails and this has the fields WorkOrderID, ServiceItemID which join the above two tables.



My problem is that I can't get the subform to list all the records that are in the table tblServiceItems, it only shows each record if you go through and select it manually. What I want it to do is to show like a listbox and allow me to go through the list and check of those service items once they have been completed. On top of this I want all those service items for that service type to be recorded against that workorder (regardless of completed or not) so then when I create a report on a WorkOrder It will list all the service items showing the checkbox's of which services have been done.



I've tried to do this with a listbox, but It doesn't show the checkbox, only yes or no. I've also tried using the tblServiceItems as the subform but this only updated the table and didn't create a record in the table tblServiceDetails matching it with the workorder.

Any idea's please, there must be something simple that I'm missing surely.
Jul 6 '07 #1
4 2411
MMcCarthy
14,534 Expert Mod 8TB
Set the record source of the subform to ....

Expand|Select|Wrap|Line Numbers
  1. SELECT tblServiceDetails.WorkOrderID, tblServiceItems.ServiceItemID, ServiceDescription, ServiceCompleted
  2. FROM tblServiceDetails INNER JOIN tblServiceItems
  3. ON tblServiceDetails.ServiceItemID = tblServiceItems.ServiceItemID
  4.  
Also check the relationship between tblServiceDetails and tblServiceItems. Open the relationship window and double click on the relationship. When the properties window opens make sure the Referential Integrity, Cascade Update and Cascade Delete fields are all ticked.
Jul 7 '07 #2
Thankyou for reply.
I've checked the relationships and they appear fine, and checked the properties and made them as you suggested. I also tried the SQL code in the record source, however this doesn't seem to overcome my problem of the subform not listing all the service item records (which are in the table tblServiceItems), It allows you to add each record individually (bit like data entry) but that creates problems in itself by accidently selecting the same ServiceItemsID twice, or the user may miss a one of the service items.

Below is an example of my table and query structure, this may make it more clear.

TABLES

tblServiceItems
ServiceItemsID (Primary key)
ServiceItemDescription
ServiceTypeID
ServiceItemStatus

tblServiceDetails
WOID (Primary key)
ServiceItemsID (Primary key)
ServiceCompleted (checkbox)

tblServiceType
ServiceTypeID (Primary key)
ServiceTypeCode
ServiceTypeDescription

tblWorkOrder
WOID (Primary key)
FleetID
ServiceTypeID
WOStartDate
WOFinishDate, etc


QUERIES

qryWorkOrder (used in the frmWorkOrder)
This query has the tables; tblWorkOrder and tblServiceDetails
Relationship is one to many, joined by the WOID with a join property # 2 (wont work any other #).
All fields from the tblWorkOrder have been selected.

qryWorkOrderSub (used in the frmWorkOrderSub - datasheet view)
This query has the tables; tblServiceItems and tblServiceDetails.
Relationship is one to many, joined by the ServiceItemId with join property #1.
Selected fields from these tables are;
All fields from the tblServiceDetails and only, fields ServiceDescription and ServiceTypeID from the tblServiceItems.


thankyou
Jul 7 '07 #3
Would anyone have some more ideas I could try please.

This is a link to what my relationships, table, queries and form looks like if this helps.
view images
Jul 8 '07 #4
Scott Price
1,384 Expert 1GB
I'm not an expert, but I'm wondering if you should restructure your table/relationships to begin with. Just an idea, and could be off target. Something looks strange, though, with your db relationships window.

If you remove the relationship between tblServiceItems and TblWorkOrder, and instead link the two through the tblServiceDetails (adding a servicetypeId field in that table and removing it from TblWorkOrder), it should simplify the task of implementing your db design.

Looks like you might need to restructure your queries and maybe forms also.

Another suggestion is to remove the WOID field from your subform and underlying query, MaintenanceDetails. It looks to me like your query is filtering based on the WOID # and as it only finds one, it only returns one record? You shouldn't need the WOID on that subform, as the workorder table and the serviceitems/types tables will be linked through your tblServiceDetails.

You asked for ideas! Hope these make sense and help.
Jul 9 '07 #5

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

Similar topics

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...
3
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode...
12
by: Paul T. RONG | last post by:
Is it possible to divide a tall subform with 80 records to two subforms each with 40 records? Dear All, What I have: Tables: tblProduct, tblOrder, tblOrderDetail
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
3
by: Simone | last post by:
Hi All, I have a Find Record button setup in most of my forms in order to find a specific customer's details. I have just noticed today though that this search will only find the customer if it...
6
by: MLH | last post by:
When the vehicle entry form (frmVehicleEntryForm) first opens, the additional owner SubForm control (frmAddnlOwnrListSubForm) is enabled. You can click on it and it will accept the focus. But after...
1
by: MLH | last post by:
I have a form with a subform control on it listing records returned by a saved query named UnbilledVehicles. I would like to put command buttons on the main form to apply dynamic filters to the...
14
kcdoell
by: kcdoell | last post by:
Hello: I have a form (Default view =single form) with a subform (Default view =continuous forms) embedded into it. In the form I have three controls that display the Division, Working Region &...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
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: 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: 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
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
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
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...

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.