How can I retrieve a form by using a text

N

Neil

I have a customer list form in data sheetview. There are several names in
there and i want to open a form by double clicking a name in the list. In
doing so, the form name Customer details will open with the details of the
specified customer. Can you help me please.
 
F

fredg

I have a customer list form in data sheetview. There are several names in
there and i want to open a form by double clicking a name in the list. In
doing so, the form name Customer details will open with the details of the
specified customer. Can you help me please.

Code the Control's Double-click event:

DoCmd.OpenForm "CustomerDetails", , , "[RecordID] = " & Me.[RecordID]

The above assumes you have a field in the table that is a unique prime
key field, of Number datatype.
Change [RecordID] to whatever the actual name of hyour field is.

If the Prime Key field is a Text datatype, you would use:
"[RecordID] = """ & Me.[RecordID] & """"
 
G

George

Hello Neil,

You can create a form showing all customers names, e.g. continuous form and
a second form to show all details of the customer (single form).

In the second form the datasource should be your customers table, filtering
the customer selected in the first form, using a simple filter in the
sql/query builter, i.e. [[Forms]![YourFirstFormName]![YourCustomerPrimaryKey].

Then using a macro or VBA you can set the double click property of the
CustomerID on your first form to open your second form.

Hope this helps,

GeorgeCY

Ο χÏήστης "Neil" έγγÏαψε:
 
N

Neil

Mr. FredG.

I tried using the docmd, however an error is coming out. "Compile error".

I was entereing it in the properties event. I am not adept using the docmd.
if you could show me how to make this as a macro. this will help me really
good.

fredg said:
I have a customer list form in data sheetview. There are several names in
there and i want to open a form by double clicking a name in the list. In
doing so, the form name Customer details will open with the details of the
specified customer. Can you help me please.

Code the Control's Double-click event:

DoCmd.OpenForm "CustomerDetails", , , "[RecordID] = " & Me.[RecordID]

The above assumes you have a field in the table that is a unique prime
key field, of Number datatype.
Change [RecordID] to whatever the actual name of hyour field is.

If the Prime Key field is a Text datatype, you would use:
"[RecordID] = """ & Me.[RecordID] & """"
 

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