Type Mismatch; Object Required

E

EdwardA

At first, second, and third glance my code looks solid.
Statement > Open form where part number = text box or
where alternate part number = text box. Something is
obviously missing though.

Any takers?

Heres my code:

Private Sub Command3_Enter()
On Error GoTo Err_Command3_Enter

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "PARTS_WHSE27"

stLinkCriteria = "[Part Number]" & "'" & Me![Text1]
& "'" Or "[Alternate Part Number]" & "'" & Me![Text1] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.RunCommand acCmdTileHorizontally

Exit_Command3_Enter:
Exit Sub

Err_Command3_Enter:
MsgBox Err.Description
Resume Exit_Command3_Enter

End Sub
 
G

Graeme Richardson

I can see that you where condition is incomplete:
stLinkCriteria = "[Part Number]=" & "'" & Me![Text1] & "'" Or "[Alternate
Part Number]=" & "'" & Me![Text1] & "'"

The malformed where condition is probably causing the form not to load and
the error is caused/raised by the next statement:
DoCmd.RunCommand acCmdTileHorizontally

See if this fixes the problem.


Also ([probably] unrelated to the problem), I think you're using the Enter
event of a command button, don't you mean to use the Click event?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top