For anyone doing the a similar project here's the syntax that worked for me. The one posted before this one did not work.
if Me.SpeedScan = True And DCount("UPC", "merchandisetable", "UPC=" & "Forms!MainSearchForm!searchtext") = 1 Then
Me.SelectedData = Me.SelectedData & DLookup("ID"...