Forms / Subforms and a question

Wesley

Registered User.
Local time
Today, 01:59
Joined
Dec 10, 2002
Messages
38
I noticed that in the toolbox you can create a command button, that you can do things like increment or decrement records etc.

What i am doing is working on a Preventative maintenance database. I have the Preventative Maintenance side of things working, but, i want to have a feature that will let me record dates, descriptions of what was done, retests etc., etc. for when each piece of equipment breaksdown.

I would like to use the command button so that i can add perhaps a subform, that i could keep track of everytime i have to do corrective maintenance on a piece of equipment.

any ideas?
 
okay
i've been plunking around and it seems as though you can use the command button to create a new form

=CreateForm([InvtervalDemo],[CorrectiveMaintLog])

when i use this for the "on click" of my new command button, it successfully creates a blank form. However i get the following error:

The expression On Click you entered as the event property setting produced the following error: The object does not the Automation object 'IntervalDemo.' .

* The expression may not result in the name of a macro, the name of a user defined expression, or [event procedure]

* There may have been an error evaluating the function, event or macro.

i don't know if creating a new form for adding incidents of maintenance for each piece of equipment i may have is the right way of going about this. Is there a better way of going about this, when, i would not necessarily know (a) how many pieces of equipment i may have, and (b) how many times i may need to add records that they have had corrective maintenance performed on them?
 
Wesley said:
any ideas?

Umm... figure it out?

Seriously, what are you asking? Are you looking for opinions on the best way to proceed, or are you asking how to set up a command button to open a subform, or are you hoping someone will set this up for you? What's the specific question?

Yes, you can easily have a command button open a subform that will add new records to a separate "breakdown" table. Step one: set up the new breakdown table. Step two: design the subform. Step three: Add the command button to your original form.

Check out the Northwinds sample db, it has tons of practical, useful examples.

--Stepping Mac
 
Wesley said:
okay
i've been plunking around and it seems as though you can use the command button to create a new form

You shouldn't be trying to have your command button CREATE a form, at least not at this stage. Design the form as you did the first one and have the command button open it.

--Quicky Mac
 
great great
ok, the "open form" was a great step in the right direction. But, its not really getting me where i want to go.

When i am on my main form, and i press the "new corrective maint" button, the form i created opens - great. However, this form shows me all the maintenace that would have been done to every piece of equipment in my main database vs. just the corrective maintenance that has been done to THAT unique piece of equipment.
 
Base the form on a query selecting the exact data you need.
 
okies
getting closer
i set up a query to the breakdown table. Made a command button to open that form.

i just need some help linking the records of corrective maintenance to the items on my main form. I'm probably not doing the query correctly.

I have 3 tables.
1 is for periodicity that PREVENTIVE maintenance is required
2 is an equipment table
3 is a breakdown table that is meant to store incidents of corrective maintenance.

currently when i open the Query form, it creates a brand new record, that doesn't seem to be tied to the form entry from whence i hit the command button to open the query / form.
 
is there a way, that when using a query if i have a field on my form / in a table called EquipmentName that when i push my command button, it will open a form, and preload things like Equipment Name, Drawing Number (Contained in same table as Equipment Name), Asset Number (Contained in same table as Equipment Name)?

regards,
sorry to be such a pest.
 
Have you bound your query to the form by setting the form's RecordSource property to your query, and then set your controls' ControlSource to the fields of your query?
 
Base your subform on a query. In the criteria for the Equipment Name put =Forms![MainForm]![Equipment Name] substituting the relevant form name and control name
 
thanks much
slowly but surely its coming together. Honestly, i realize i'm a complete noob, but, the only way i can learn is to just plunk away, and ask questions. I do sincerely appreciate all of your guy's help.
 
I think you said that you are using a separate form rather than a subform. If that is the case, look up the OpenForm Method in help. It will describe the "where" argument which will let you "sync" the data shown by the two forms.
 
it really doesn't matter too much which i use, be it form or subform.. the thing i'm still having trouble with is properly syncing up corrective maintenance records with their respective piece of equipment.

i can get the form to open with the fields i want but if i go to a record containing a piece of equipment, push my command button to enter a corrective maintenance activity, the form opens - great, i can record the fields i need to record - great. But, say, if i go back to my main form, go to another equipment record, push the command button again, i can scroll through all the records of corrective maintenance - not desirable - i only want to see corrective maintenance for THAT piece of equipment. Not only that symptom, but, the equipment name changes based on whatever main record i happen to have pushed the command button from at the present time.

/sigh

i really appreciate your guy's patience with me on this. I'm trying to scroll through the help files whenever i can here at work to try and learn this silly program.

regards,
 
If you use a mainform/subform setup, then Access will handle the sync for you.
 
trying that now... i'd be further along, but i keep getting interrupting every 37 seconds by suppliers, contractors, or my wife.
 
ok
i have put in a subform into my main form. The keeping track of data part seems to be working correctly - meaning that, i can enter multiple instances of corrective maintenance for each piece of equipment i have on my main form.

Question: This "subform" that i have dutifully called "corrective maintenance" looks like a table. What can i do to change its appearance? I would prefer this looks like a "regular form". Additionally, i'd like to be able to enter data into several fields "Date of Failure, Date Completed, Corrective Maintenance performed, and Cost" and then hit a button, at which point in time, the form would "update" so that breakdown instance was recorded (so that the next time that piece of equipment had a breakdown, i could toggle through a list of previous failures to see if i have recurring problems.

again, sorry for all the questions.
 
k
one more thing

if i have the subform on the same "page" that my form is on, then all my entries are kept sequentially

if i use a command button on the same "page" that my form is on to open the precreated subform, then all the data is kept, however, corrective maintenance entered for machine 1, is displayed and accessible when i hit the command button to open the subform when i am looking at machine 2 on my main form.
 
k
one more thing

if i have the subform on the same "page" that my form is on, then all my entries are kept sequentially

if i use a command button on the same "page" that my form is on to open the precreated subform, then all the data is kept, however, corrective maintenance entered for machine 1, is displayed and accessible when i hit the command button to open the subform when i am looking at machine 2 on my main form.

i'd like to be able to hit a command button on my main form, which would open the subform to make / view corrective maintenance entries for ONLY that record, and then have a button on my subform which would make that entry. Also, would desire another command button on the subform that would close the subform.

edit: never mind, i figured it out. Just gotta make the command button to close the subform when i'm finished with it now.
 
k
couple more things
is there a way to pre fill a field on my subform?
Basically, everytime i hit the "Corrective Maintainance" command button on my main form (to open this subform), would it be possible to "pre fill" the newly opened subform with the Equipment Name?
 

Users who are viewing this thread

Back
Top Bottom