Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search brings up blank form

Status
Not open for further replies.

metrodub

Technical User
Dec 29, 2004
82
US
I have a textbox on a form that I use to search for invoices. When I enter an invoice number and press the search button, an invoice form opens but does not contain any data. The invoice number is in the invoice table.

Here is my code:
Code:
rivate Sub cmdInvoiceSearch_Click()
    Dim strDocName As String
    Dim strLinkCriteria As String
    
    strDocName = "frmInvoice"
   
   If Len(Trim$(Me!txtInvoiceSearch & vbNullString)) = 0 Then
     MsgBox "Nothing Entered. Please Enter Some Value."
     Me.txtInvoiceSearch.SetFocus
   Else
    strLinkCriteria = "[InvoiceNumber]= ' " & Me![txtInvoiceSearch] & "'"
    DoCmd.Close acForm, "frmOasisStart"
    DoCmd.OpenForm strDocName, , , strLinkCriteria, , , "frmOasisStart"
   End If
   
End Sub

InvoiceNumber is a text data type and is not the primary key.

Any suggestions as to why a blank form opens?

Thanks
 
How are ya metrodub . . . . .

Remove the space:
Code:
[blue]strLinkCriteria = "[InvoiceNumber]= '[highlight] [/highlight]"[/blue]

Calvin.gif
See Ya! . . . . . .
 
wow, can't believe it was all about a space.

Thanks AceMan!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top