Full Version: SUBFORM> create a subform that only "appears" when you slect
UtterAccess Forums > Microsoft® Access > Access Forms
Is this possible? and if so HOW?
Making a subform that only comes up or appears after the field 1DUI/combo box Yes;No/ "Yes" is selected.
at this point a subform (will also be titled 1DUI) appears with the cursor in the first field in the subform ready for
Ounderstand that a table will need to be created and linked to the "MAINTABLE" via a relationship
actually have a subform already created for "Aditional vehicles" which only comes up when a command button
is activated. When this Additional vehicles form comes up, the case number in the Main Form automatlicly
fills in the CASE NO field in the Add Veh form. Is this still a "SUBFORM" ? Tables are linked "one to many" in a
Never used the Subform Wizard Before because work computers did not have that option
Work upgraded to Office 03 and I convinced the powers to make sure ALL of the options were included.
So, should I wizard it then add code to the subform? or just code the whole procedure? If Possible
Are you popping up a new form that's linked to the main form?
FOr is the subfrm hidden on the main form and you make it visible with the checkbox?
its a new form linked to the main form (relationship between tables one to many)
On the new form (not yet created) 1DUI I want it to be hidden and visible with either a check box or
a "Yes" on the Is it a DUI? field. What ever works better/check box or yes/no from a value list
can this be done??
Are you familiar with VBA? . . . beyond the wizards.
That you're proposing is doable . . . but it will require some code.
You could use the After_update event of the cbo and test for the DUI.
Then if you wish to open the form, make the open form cmd button enabled if DUI or disabled if not:
If cbo = 1 then
cmdNewForm.Enabled = true
cmdNewForm.Enabled = False
end if
If your on a continuous form, you can peform this check on the OnCurrent event.
Is this making sense?
This is the code that I have aquired thru forum help to open the "subform"
explained on post 1 This proceedure starts when the BUTTON is depressed
Private Sub to_open_pg_2_Click()
On Error GoTo Err_to_open_pg_2_Click
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TRAFFIC DATA PG2"

stLinkCriteria = "CASENUMBER=" & " '" & Me!CASENUMBER & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.CASENUMBER
Exit Sub
MsgBox Err.Description
Resume Exit_to_open_pg_2_Click

End Sub
this opens page 2 form with the corrisponding case number already placed in the case no field of page 2
Oalso had to put this code on page 2 code
Private Sub Form_Current()
If Me.NewRecord Then
If Not IsNull(Me.OpenArgs) Then
End If
End If
End Sub
What I want to happen on the 1DUI form is the same thing except starting on a combo box answer "Yes"
not the button push method
So it would be field 1DUI / combox box Yes/No / if yes open 1DUI FORM
Ok got this to work to open DUI FORM and was not created as a subform, just two forms linked together
Private Sub Ctl1DUI_AfterUpdate()
If [1DUI] = True Then
Dim stDocName As String
Dim stCriteria As String
stDocName = "DUI FORM"
stLinkCriteria = "CASENUMBER=" & "'" & Me!CASENUMBER & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.CASENUMBER
End If
End Sub
NOW...... I need a code to put on the last field, after data entry or "enter"
so that the DUI FORM closes and there is a SetFocus to the 1PED field in the MAIN FORM
last fied name on DUI FORN is :1LASTDRINKLOCAT
You could stick a update command button on the form that would do as you wish:
et focus
Forms!MAIN FORM.1PED.SetForcus
close form
DoCmd.Close acForm, "DUI FORM"
A couple suggestions . . .
- use the prefixes from here ( LESZYNSKI (HUNGARIAN) NAMING CONVENTION ) for objects: example: frmDUI
- avoid using spaces. You can name things using embedded caps: frmPurchaseOrders or use underscores frm_Purchase_Orders
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.