Gary Hull said:
How do I pass the variable to the report?
You don't need to pass anything. Refer to the form's control names in the
report's open event, for example (untested):
Dim strSQL as String, strSortOrder As String, strFieldName1 as String,
strFieldValue1 as String
If [Forms]![frmMyDialog]![ogrSortOrder] = 1 then strSortOrder = "Asc"
If [Forms]![frmMyDialog]![ogrSortOrder] = 2 then strSortOrder = "Desc"
strFieldName1 = [Forms]![frmMyDialog]![cboField1]
strFieldValue1 = [Forms]![frmMyDialog]![cboValue1]
strSQL = "Select * from qryMyQuery where " & strFieldName1 & " = " &
strFieldValue1
strSQL = strSQL & " Order by " & strFieldName1 & " " & strSortOrder
Me.RecordSource = strSQL
This code isn't the B-all and end-all but it should give you a starter for
ten.
Regards,
Keith.