combo box need help

S

shoa

Hello all

I created a simple table of Customers with three fieds: Customer ID (primary
key), name and address. I have some records in that table.
Now I have to create a Form to view each record or add more records.
Both of these tasks are simple

Now in this Form, I insert a Combo Box. The purpose of this box, is that
when I enter Customer ID (or select) in this Combo Box, the details of that
customer will be shown in the Form.
I use a Combo Box wizard to do this task. and choose the option 3: Find a
record on my form based on the value I selected in my combo box. Then I
select a field: Customer ID and so on. All those steps are OK.

However, when I enter (or select) a value of Customer ID on this Combo Box,
there are error presented in Visual Basic Window as the following:
-------------------------------------------------
Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim rs as Object // ----Error in this line

Set rs = Me.Recordset.Clone
rs.FindFirst "[Customer ID] = " & Str(Me![Combo1])
Me.Bookmark = rs.Bookmark
End Sub
-------------------------------------------------

I do not know why as I did all steps by using Wizard !!!

Could you please help, thank you very much
S.Hoa
 
T

Tom Wickerath

Check to make sure that you don't have any missing references. Missing references can cause
strange errors.

http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html

http://members.iinet.net.au/~allenbrowne/ser-38.html


Tom
__________________________________________


Hello all

I created a simple table of Customers with three fieds: Customer ID (primary
key), name and address. I have some records in that table.
Now I have to create a Form to view each record or add more records.
Both of these tasks are simple

Now in this Form, I insert a Combo Box. The purpose of this box, is that
when I enter Customer ID (or select) in this Combo Box, the details of that
customer will be shown in the Form.
I use a Combo Box wizard to do this task. and choose the option 3: Find a
record on my form based on the value I selected in my combo box. Then I
select a field: Customer ID and so on. All those steps are OK.

However, when I enter (or select) a value of Customer ID on this Combo Box,
there are error presented in Visual Basic Window as the following:
-------------------------------------------------
Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim rs as Object // ----Error in this line

Set rs = Me.Recordset.Clone
rs.FindFirst "[Customer ID] = " & Str(Me![Combo1])
Me.Bookmark = rs.Bookmark
End Sub
-------------------------------------------------

I do not know why as I did all steps by using Wizard !!!

Could you please help, thank you very much
S.Hoa
 
T

tina

see Tom's response to help with your coding error.
here's a side comment on your table structure:
I created a simple table of Customers with three fieds: Customer ID (primary
key), name and address.

your table is not normalized! if the customer is a company, a single name
field makes sense; if a person, then you should have a minimum of 2 fields:
FirstName and LastName. if you are storing a complete address, you need a
minimum of 4 fields: Street, City, State, ZIPCode.
leaving multi-field data in single fields is going to make it very, very
difficult - if not impossible - to do virtually anything practical with the
data, such as sorting, grouping, printing address labels, etc, etc, etc.

hth


shoa said:
Hello all

I created a simple table of Customers with three fieds: Customer ID (primary
key), name and address. I have some records in that table.
Now I have to create a Form to view each record or add more records.
Both of these tasks are simple

Now in this Form, I insert a Combo Box. The purpose of this box, is that
when I enter Customer ID (or select) in this Combo Box, the details of that
customer will be shown in the Form.
I use a Combo Box wizard to do this task. and choose the option 3: Find a
record on my form based on the value I selected in my combo box. Then I
select a field: Customer ID and so on. All those steps are OK.

However, when I enter (or select) a value of Customer ID on this Combo Box,
there are error presented in Visual Basic Window as the following:
-------------------------------------------------
Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim rs as Object // ----Error in this line

Set rs = Me.Recordset.Clone
rs.FindFirst "[Customer ID] = " & Str(Me![Combo1])
Me.Bookmark = rs.Bookmark
End Sub
-------------------------------------------------

I do not know why as I did all steps by using Wizard !!!

Could you please help, thank you very much
S.Hoa
 
T

Tom Wickerath

Thanks Tina!

I meant to comment on that table structure myself, but I forgot to include that before sending.

____________________________________


see Tom's response to help with your coding error.
here's a side comment on your table structure:
I created a simple table of Customers with three fieds: Customer ID (primary
key), name and address.

your table is not normalized! if the customer is a company, a single name
field makes sense; if a person, then you should have a minimum of 2 fields:
FirstName and LastName. if you are storing a complete address, you need a
minimum of 4 fields: Street, City, State, ZIPCode.
leaving multi-field data in single fields is going to make it very, very
difficult - if not impossible - to do virtually anything practical with the
data, such as sorting, grouping, printing address labels, etc, etc, etc.

hth

____________________________________


shoa said:
Hello all

I created a simple table of Customers with three fieds: Customer ID (primary
key), name and address. I have some records in that table.
Now I have to create a Form to view each record or add more records.
Both of these tasks are simple

Now in this Form, I insert a Combo Box. The purpose of this box, is that
when I enter Customer ID (or select) in this Combo Box, the details of that
customer will be shown in the Form.
I use a Combo Box wizard to do this task. and choose the option 3: Find a
record on my form based on the value I selected in my combo box. Then I
select a field: Customer ID and so on. All those steps are OK.

However, when I enter (or select) a value of Customer ID on this Combo Box,
there are error presented in Visual Basic Window as the following:
-------------------------------------------------
Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim rs as Object // ----Error in this line

Set rs = Me.Recordset.Clone
rs.FindFirst "[Customer ID] = " & Str(Me![Combo1])
Me.Bookmark = rs.Bookmark
End Sub
-------------------------------------------------

I do not know why as I did all steps by using Wizard !!!

Could you please help, thank you very much
S.Hoa
 
S

shoa

Thanks
The table I wrote is only a simple table for easy to understand. However, I
sorry as it is not so clear. The form is OK now
Thanks Tome and Tina
 
T

tina

no problem - next time i'll need you, or somebody, to get my back (again).
<g>


Tom Wickerath said:
Thanks Tina!

I meant to comment on that table structure myself, but I forgot to include that before sending.

____________________________________


see Tom's response to help with your coding error.
here's a side comment on your table structure:
I created a simple table of Customers with three fieds: Customer ID (primary
key), name and address.

your table is not normalized! if the customer is a company, a single name
field makes sense; if a person, then you should have a minimum of 2 fields:
FirstName and LastName. if you are storing a complete address, you need a
minimum of 4 fields: Street, City, State, ZIPCode.
leaving multi-field data in single fields is going to make it very, very
difficult - if not impossible - to do virtually anything practical with the
data, such as sorting, grouping, printing address labels, etc, etc, etc.

hth

____________________________________


shoa said:
Hello all

I created a simple table of Customers with three fieds: Customer ID (primary
key), name and address. I have some records in that table.
Now I have to create a Form to view each record or add more records.
Both of these tasks are simple

Now in this Form, I insert a Combo Box. The purpose of this box, is that
when I enter Customer ID (or select) in this Combo Box, the details of that
customer will be shown in the Form.
I use a Combo Box wizard to do this task. and choose the option 3: Find a
record on my form based on the value I selected in my combo box. Then I
select a field: Customer ID and so on. All those steps are OK.

However, when I enter (or select) a value of Customer ID on this Combo Box,
there are error presented in Visual Basic Window as the following:
-------------------------------------------------
Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim rs as Object // ----Error in this line

Set rs = Me.Recordset.Clone
rs.FindFirst "[Customer ID] = " & Str(Me![Combo1])
Me.Bookmark = rs.Bookmark
End Sub
-------------------------------------------------

I do not know why as I did all steps by using Wizard !!!

Could you please help, thank you very much
S.Hoa
 

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