This is my VBA code so far, but I keep getting debug errors. Pretty much this code takes two commands buttons 1 goes to a "NETDataForm" while the other goes to "COLDataForm". However the samples dont always have both tests done, so I used a multivalue combobox to determine which tests are done, so If NETest was done the value in TestType should be "NET" while if the Colon test was done then the TestType should say "COL" and if both were done it should say "COL, NET" (alphabetically). But as of now I cant use an If than statement with the string it makes. (Debug: If CurTestType = "NET" Then)
Code:
Option Compare Database
Private Sub Command55_Click()
DoCmd.OpenForm "NETDataForm"
End Sub
Private Sub Command56_Click()
DoCmd.OpenForm "COLDataForm"
End Sub
Private Sub Form_Load()
Me.Command55.Visible = False
Me.Command56.Visible = False
End Sub
Private Sub Form_Current()
CurTestType = Me.TestType.Value
Me.Refresh
If CurTestType = "NET" Then
Me.Command55.Visible = True
ElseIf CurTestType = "COL" Then
Me.Command56.Visible = True
ElseIf CurTestType = "COL, NET" Then
Me.Command55.Visible = True
Me.Command56.Visible = True
End If
End Sub
Ik ranman said it is difficult to make a query using the multivalue combobox, but I do need to know how to do this, so how is that possible using this code for a search query?
Code:
LIKE "*" & Forms!SearchSampleForm!TestType.Combobox.Value & "*"