D
darrep
I have a form that allows a user to select a value in either cboReportNum or
cboReportName that information in the subform is based on. WHen wither a
number or name is chosed, the other cboBox autoupdates to the corresponding
value.
When the form first opens, information is contained in the subform from the
first record in the table. Is there any way to keep the subform values blank
until something is chosen from the box?
Private Sub cboReportNum_Exit(Cancel As Integer)
'Automatically updates report name when a report number is entered
Dim intIndex As Integer
If cboReportNum <> "" Then
If cboReportNum.ListIndex <> cboReportName.ListIndex Then
'eliminates endless focus loop that occurs if already the same
intIndex = cboReportNum.ListIndex
cboReportName.SetFocus
cboReportName = cboReportName.Column(BoundColumn, intIndex)
'Display the maintenance information based on the selected report
Set rs = Me.Recordset.Clone
rs.FindFirst "[REPORT_ID] = " & Str(Me![cboReportName])
Me.Bookmark = rs.Bookmark
End If
End If
End Sub
The code is copied below.
cboReportName that information in the subform is based on. WHen wither a
number or name is chosed, the other cboBox autoupdates to the corresponding
value.
When the form first opens, information is contained in the subform from the
first record in the table. Is there any way to keep the subform values blank
until something is chosen from the box?
Private Sub cboReportNum_Exit(Cancel As Integer)
'Automatically updates report name when a report number is entered
Dim intIndex As Integer
If cboReportNum <> "" Then
If cboReportNum.ListIndex <> cboReportName.ListIndex Then
'eliminates endless focus loop that occurs if already the same
intIndex = cboReportNum.ListIndex
cboReportName.SetFocus
cboReportName = cboReportName.Column(BoundColumn, intIndex)
'Display the maintenance information based on the selected report
Set rs = Me.Recordset.Clone
rs.FindFirst "[REPORT_ID] = " & Str(Me![cboReportName])
Me.Bookmark = rs.Bookmark
End If
End If
End Sub
The code is copied below.