Do not use on any
shared computer
August 29, 2008 02:54pm pdt
 
[x]
Attachment Details

Loading a record on a subform from a combo box - error message

Tags: Microsoft, Access, 2003, VBA
Hi

I'm developing a database for a music shop for a college project.  I have a form setup whereby Customer record is the main form and Order information is the subform. On the customer form I have a combo box which selects the customer record and loads it onto the form. Then obviously all the orders for that customer load in the order subform.

Now in the order subform I want to add an extra level of functionality by having a combo box again, where the user can select an order No and load it onto the subform, rather than having to scroll through the records.  I am using an unbound combo box, and have got the row source to only show records from that customer.

However I can't get the Order No. from the Combo box to load into the Order No. on the subform. I think it may be bacause my Order No. is an auto Number?

Here is the code I am trying to use to make the combo box load the record into my Order subform:

----------------------------------------------------------
Private Sub cboFindOrder_AfterUpdate()

Forms![frmShopOrders].Form![frmShopOrdersSubform].SetFocus
Me.Form.RecordsetClone.FindFirst "[OrderNo]='" & Forms![frmShopOrders]![cboFindCustomer] & "'"
If Not Me.Form.RecordsetClone.NoMatch Then
 Me.Form.Bookmark = Me.Form.RecordsetClone.Bookmark
End If

End Sub
------------------------------------------------------------

cboFindOrder is my 'find order' combo box.  cboFindCustomer is the combo box on the main form.  The error message I am getting is:

Run time error 3464
Data type mismatch in criteria expression.

I'm thinking this is because Find Customer is a text data type and order no is an autonumber.  However I'm not expereienced enough at VBA to find a solution to this mismatch.  Anyone have any suggestions? I am probably making some fundamanetal error here because Im fairly new to VBA coding and am trying something a bit harder than usual.  the code I used was already off a solution on this forum but am thinking it isnt appropriate for my situation.
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Microsoft
Question Asked By: JimmyBiggs
Solution Provided By: koutny
Participating Experts: 1
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Author Comment by JimmyBiggs
Author Comment by JimmyBiggs:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by koutny

Rank: Master

Accepted Solution by koutny:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by JimmyBiggs
Author Comment by JimmyBiggs:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by koutny

Rank: Master

Expert Comment by koutny:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628