how to take a value from one form to anothor (1 Viewer)

sspreyer

Registered User.
Local time
Today, 03:09
Joined
Nov 18, 2013
Messages
251
ok

here's copy of my db

open form "frmplant"

Select Plant Type From Combo Box

then press command button " Add service"

this will open From "frmpopupPlantservice with sub from plantservicetbl subform

this will give you the service details of the plant item
then you will see text box showing next service due in the page footer


the Plantservicetbl subform record source Qryplantservice this were i need you to look

there is speech bubbles to help aswell
View attachment shanetest2.zip

thanks

shane
 

vbaInet

AWF VIP
Local time
Today, 11:09
Joined
Jan 22, 2010
Messages
26,374
Unfortunately there are problems everywhere based on the two forms I've quickly looked at. I don't have time to scrutinise any further but here are some of the issues:

1. You're using subforms when you don't really need them. You parent forms can be set to Continuous forms and you can put the textboxes and combo boxes you don't want repeated in the form's Header section.
2. Saving calculated fields is not necessary (in your case) and a bad practice. Due date can be calculated anytime you need it.
3. Creating a query just so you can use a DateAdd() function that pulls data from a field in a subform is not necessary. There are other ways to get the date value and perform the calculation on it.

At this point the best thing for you to do is to get some advice on your table structure and ask for some help on restructuring your form. You'll need to create separate threads for these questions.

Do it once and get it right!
 

sspreyer

Registered User.
Local time
Today, 03:09
Joined
Nov 18, 2013
Messages
251
hi
VbaInet

just response before I close the thread

after take on board your finding and doing a lot reading and research

I ended up doing a complete re-design of my db:banghead: reduce sub forms and I run everything from one query

I have resolved the issues in this thread by using the dmax function on my new design db but with a criteria

Code:
 FindLast: DMax("[MaskServiceDate]","[MaskServiceTbl]","([ImpMaskID]= " & [MaskID] & ")")
then calculating the next service by
Code:
NextService: DateAdd("m",[MaskServiceMonths],[FindLast])

and keeping it all on one form hooray:cool:
as the say goes "Do it once and get it right!"

thanks for pointing us in the right direction

cheers

shane
 

Users who are viewing this thread

Top Bottom