Access Access 2007 problem when viewing records found using a search form

Sep 23, 2009
Reaction score
I am a Access newbie with very little VB coding experience and would greatly appreciate any help in sorting out my problem. One which I have been trying to solve in vain for many days.

I have a customer table one of the fields is FirstName. I have managed to design a form named Customer Search which searches the CustomerDetails table and shows the results in a form.

I have a command button on this form which when clicked should open the selected record for viewing/editing. However this does not happen and I get an error window which shows the FirstName chosen and error message "Enter Parameter Value' if I then type the name it opens the record. I want the record to be opened automatically without any further user input.

FirstName is a Text field.

My Code is as follows:

Option Compare Database

Private Sub Search_Click()

Dim sSearch As String

'read the seach string from the form

'note: NZ() ensures that nulls are converted to empty strings

sSearch = Nz(Me.SearchString, "")

'Check if the search string is empty or not and set the filter accordingly

If sSearch = "" Then

Me.Filter = ""


Me.Filter = "[FirstName] LIKE '*" & sSearch & "*'"

End If

'turn on the forms filter

Me.FilterOn = True

End Sub

Private Sub Command11_Click()

DoCmd.OpenForm "Add Customer", , , "[FirstName] = " & Me!FirstName

End Sub

I would really appreciate any help.

Thanks in advance



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