Procedure Form and Subform

mugen_rsx

Registered User.
Local time
Today, 12:06
Joined
Dec 1, 2004
Messages
20
I am creating a form here
the Main form need to fill in (or may already fill in in another form) some headings like date, name, memo details, ect.
On the subform, there is a procedure list out all the steps and need to fill out who have done this step, and date, etc

My main problem is on the subform, I have no idea how to create the "list out all steps". Because there are too many steps here, it may waste a lot of time if I have to type in the procedure name for each steps.
I have created a table of all steps' names.

Thank you for your hlep!!!

mugen_rsx
 
Could someone please give me a hand here? I am really stuck right now. :(

this is my first time coming to this site/forums, if this has been answered before, pelase let me know the link. Really appreciate for any help here
 
Procedure

You may need 3 tables, one for the main information, one on which the subform is based and is linked to the main table, and a lookup table holding the 'steps'.
That way you can ad unlimited records on the subform and use a lookup table for the steps so you don't have to type in everything.
Based on the brief info you gave, this is all I can say. Perhaps you can give more detailed info or upload your database (without sensitive info).
Good Luck.
Trucktime
 
Thanks for your reply trucktime

I have created the 3 tables now. I understand that the lookup feature, so now I just have to choose (scroll) to the "step" that I need to fill-in.

My concern right now is that since all the steps are fixed (I mean there are step 1, step 2, step 3, and so on for all the procedures), can I in my form shows all steps at once? Like the following

step1 name
step2 name
step3 name
step4 name

when I open up the form, all steps are fixed shown like above, and I just need to type in the name. Am I be able to do so?
 
Subform

If I understand you correctly you want the following to happen: when you create a new record on the main form you need the subform automatically create as many records as there are steps. Suppose there are 6 steps, then you want 6 records in the subform, name them Step 1 - Step 6, and then select the right step in each of these records.

What you can do is this, ad a text field to your 'steps' table and call it StepName. Then put a command button on the subform, name it NewRecord and put this code in the On Click Event:

*******************************
Private Sub NewRecord_Click()
On Error GoTo Err_Command51_Click


DoCmd.GoToRecord , , acNewRec
Me.StepName = "Step 1"
DoCmd.GoToRecord , , acNewRec
Me.StepName = "Step 2"
DoCmd.GoToRecord , , acNewRec
Me.Stepname = "Step 3"
DoCmd.GoToRecord , , acNewRec
Me.Stepname = "Step 4"
DoCmd.GoToRecord , , acNewRec
Me.Stepname = "Step 5"
DoCmd.GoToRecord , , acNewRec
Me.Stepname = "Step 6"
DoCmd.Save
Me.Requery

Exit_NewRecord_Click:
Exit Sub

Err_NewRecord_Click:
MsgBox Err.Description
Resume Exit_NewRecord_Click

End Sub
*******************************

Then in the footer of the subform put an unbound box, name it: STEPCOUNT and set the data control source to: =Count(*)

Next put this in the BeforeUpdate Event of the form:

*******************************
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_BeforeUpdate_Click
If Me.NewRecord Then
If Me.Stepcount > 3 Then
MsgBox Me.Stepcount & " Steps already entered.", vbOKOnly
Cancel = True
End If
End If

End Sub
*******************************

With one click of the Command button you create 6 records in the subform, name them Step 1 - Step 2 and when you try to ad more you get a message saying that 6 steps have already been entered.
Of course can can easily change the number of steps.

Hope this helps.
 
Thank you so much trucktime, I will give it a try!! thx
 

Users who are viewing this thread

Back
Top Bottom