Problems with creating a combo box that would find a record

N

Nika

I am very new to the Database Access. I work with the 2003 version.

I have created a form based on my two tables. I have problems with creating
a combo box that will find a record on my form based on the value I selected
in my combo box. The wizard gives me only two options:
-look up the values in a table or query
-type in the values that I want

Why some forms have the third option?:
-find a record on my form based on the value in my combo box

Can somebody help me to create a combo box that would find a record ?

Thanks,
 
G

Golfinray

You need to use the combo box wizard and let it select the field from your
table that you want to use to search or filter on. Let's say that you want to
search on an ID. You go ahead and tell the wizard to create the combo and to
look up the value and select ID. Then, once your combo is created, you right
click on it, go to properties, go to events, select the afterupdate event,
start the code builder (using the little button out to the right) and then
enter this:
Me.filter = "[ID] = """ & Me.combo# & """"
Me.filteron=true

The combo number will be listed there like combo 12 or combo 6. Put that
number instead of #.
 
N

Nika

Thanks so much. I have never done building a code before. I have tried it and
unfortunately, it didn`t work. I get a message that Access can`t find the
macro `Me`.
What did I do wrong?



Golfinray said:
You need to use the combo box wizard and let it select the field from your
table that you want to use to search or filter on. Let's say that you want to
search on an ID. You go ahead and tell the wizard to create the combo and to
look up the value and select ID. Then, once your combo is created, you right
click on it, go to properties, go to events, select the afterupdate event,
start the code builder (using the little button out to the right) and then
enter this:
Me.filter = "[ID] = """ & Me.combo# & """"
Me.filteron=true

The combo number will be listed there like combo 12 or combo 6. Put that
number instead of #.

Nika said:
I am very new to the Database Access. I work with the 2003 version.

I have created a form based on my two tables. I have problems with creating
a combo box that will find a record on my form based on the value I selected
in my combo box. The wizard gives me only two options:
-look up the values in a table or query
-type in the values that I want

Why some forms have the third option?:
-find a record on my form based on the value in my combo box

Can somebody help me to create a combo box that would find a record ?

Thanks,
 
G

Golfinray

Be sure that when you click the little button to the right of the afterupdate
event that you start Code Builder, NOT one of the other options. I think you
probably picked one of the others. More than likely you tried to create a
macro which won't work for what you need to do.

Nika said:
Thanks so much. I have never done building a code before. I have tried it and
unfortunately, it didn`t work. I get a message that Access can`t find the
macro `Me`.
What did I do wrong?



Golfinray said:
You need to use the combo box wizard and let it select the field from your
table that you want to use to search or filter on. Let's say that you want to
search on an ID. You go ahead and tell the wizard to create the combo and to
look up the value and select ID. Then, once your combo is created, you right
click on it, go to properties, go to events, select the afterupdate event,
start the code builder (using the little button out to the right) and then
enter this:
Me.filter = "[ID] = """ & Me.combo# & """"
Me.filteron=true

The combo number will be listed there like combo 12 or combo 6. Put that
number instead of #.

Nika said:
I am very new to the Database Access. I work with the 2003 version.

I have created a form based on my two tables. I have problems with creating
a combo box that will find a record on my form based on the value I selected
in my combo box. The wizard gives me only two options:
-look up the values in a table or query
-type in the values that I want

Why some forms have the third option?:
-find a record on my form based on the value in my combo box

Can somebody help me to create a combo box that would find a record ?

Thanks,
 
N

Nika

Hello Again,
You were right; I didn’t start a code builder.

Well, I started again. I have entered the code in the Code Builder box and I
have changed the ID for Last Name and I put the number of my combo box.

When I exit the design view and I want to find a record, after entering a
last name, one empty record pops out stating (filtered).

I am not sure why this is not working.
Do you have any other suggestions?
Thanks.


Golfinray said:
Be sure that when you click the little button to the right of the afterupdate
event that you start Code Builder, NOT one of the other options. I think you
probably picked one of the others. More than likely you tried to create a
macro which won't work for what you need to do.

Nika said:
Thanks so much. I have never done building a code before. I have tried it and
unfortunately, it didn`t work. I get a message that Access can`t find the
macro `Me`.
What did I do wrong?



Golfinray said:
You need to use the combo box wizard and let it select the field from your
table that you want to use to search or filter on. Let's say that you want to
search on an ID. You go ahead and tell the wizard to create the combo and to
look up the value and select ID. Then, once your combo is created, you right
click on it, go to properties, go to events, select the afterupdate event,
start the code builder (using the little button out to the right) and then
enter this:
Me.filter = "[ID] = """ & Me.combo# & """"
Me.filteron=true

The combo number will be listed there like combo 12 or combo 6. Put that
number instead of #.

:

I am very new to the Database Access. I work with the 2003 version.

I have created a form based on my two tables. I have problems with creating
a combo box that will find a record on my form based on the value I selected
in my combo box. The wizard gives me only two options:
-look up the values in a table or query
-type in the values that I want

Why some forms have the third option?:
-find a record on my form based on the value in my combo box

Can somebody help me to create a combo box that would find a record ?

Thanks,
 
N

Nika

I believe that the form is bounded to a record source.
This is what I have:

SELECT [Public].[ID#], [Public].[LAST NAME] FROM [Public] ORDER BY [LAST
NAME];
 

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