Hi,
I am building a database where the user is required to enter data into several textboxes and choose some options from combo boxes. This user input is this then utilized in several relativelycomplex queries which also pulls data from a table. I have saved these as database objects. By the time I'm finished with all the queries there will be a minimum of 14 different queries that could be run, depending on the option the user selected.
Currently, I have a command button on the form that executes the following code:
Code:
Private Sub cmdGenText_Click()
If IsNull(Me.txtErrorType) Then
MsgBox "The Error Description field cannot be left blank"
Cancel = True
Me.cboErrorType.SetFocus
Else
Dim strError As String
strError = Me.txtErrorType.Value
Select Case strError
Case "Dup"
DoCmd.OpenQuery "qryAssembly_Dup", acNormal, acReadOnly
Case "DupMulti"
DoCmd.OpenQuery "qryAssembly_DupMulti", acNormal, acReadOnly
Case "DupPart"
DoCmd.OpenQuery "qryAssembly_DupPart", acNormal, acReadOnly
End Select
End If
End Sub
The query runs fine and opens in a query window. However, I want one field of the query to populate an unbound text box on the form instead. So when I click the command button instead of opening the query in a separate window I want a field called Error Text to populate a textbox called txtRxLetter. I'm sure I'm making this harder than I need to, so any help will be appreciated.
I am using Access 2010.
Thanks!