Newbie Question

  • Thread starter Thread starter A. Michaels
  • Start date Start date
A

A. Michaels

When I click on search I get the message:
-----------------------------------------
The OpenForm action was canceled.

You used a method of the DoCmd object to carry out an
action in Visual Basic, but then clicked Cancel in a
dialog box.

For example, you used the Close method to close a changed
form, then clicked Cancel in the dialog box that asks if
you want to save the changes you made to the form.
-------------------------------------------

Here is the code..... Please tell me what I am missing,
and also if you know of a good source of material to which
would help me learn more about the format of objects like
the DoCmd.
-------------------------------------
Private Sub Search_Click()
On Error GoTo Err_Search_Click

Dim stDocName As String
Dim stLinkCrtieria As String

stDocName = "Search Results"

If Not Me!Combo2 = "" Then

stLinkCriteria = "[Event#]=" & Me![Combo2]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Else If Not Me!Combo4 = "" Then

stLinkCriteria = "[File#]=" & Me![Combo4]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Else If Not Me!Combo6 = "" Then

stLinkCriteria = "[OtherFile#]=" & Me![Combo6]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End If

Exit_Search_Click:
Exit Sub

Err_Search_Click:
MsgBox Err.Description
Resume Exit_Search_Click

End Sub
 
hi,

can you put a break point on the first line and step through the code.
What line causes the error and what is the combobox value at that stage?
 
Back
Top