How would you do this?

jasonfl1

New member
Local time
Today, 15:26
Joined
Jul 1, 2008
Messages
7
In my form I have a sub/form which is based off a query just showing a few fields from the customers table. I can type a filter into my main form which affects the subform using the VBA code:

Private Sub cmdFilter_Enter()
Me.frmCustomerListing.Form.Filter = "tblCustomers.Firstname LIKE '*" & txtFirstName.Value & "*'"
Me.frmCustomerListing.Form.FilterOn = True
End Sub

Firstly, this only works if I do:
"tblCustomers.Firstname LIKE '*" & txtFirstName.Value & "*'"

and not:
"tblCustomers.Firstname LIKE '%" & txtFirstName.Value & "%'"

why would that be?

My second question is that the results shown are in datasheet mode. How could I get it so that when an entry is double clicked it brings up a form showing just that customer record? Or can I do it in a different way (datasheet looks ugly)? Thanks!
 
why would that be?
Because * is the access equevalent of the Oracle %. You cannot mix the two..

My second question is that the results shown are in datasheet mode. How could I get it so that when an entry is double clicked it brings up a form showing just that customer record? Or can I do it in a different way (datasheet looks ugly)? Thanks!
You cannot code anything in datasheet mode, but you can do this in forms...
 
You cannot code anything in datasheet mode, but you can do this in forms...
How would I do this then?
 
Use the "on double click" event of the form or Desired control to execute your code... In this case "Docmd.openform" check out the help for more information.
 

Users who are viewing this thread

Back
Top Bottom