Why can't I select anyhting from the COmboBox???

aBheE

New member
Local time
Today, 07:16
Joined
Dec 8, 2009
Messages
9
Why can't I select anyhting from the COmboBox???[Resolved]

first off i have 2 tell u i am kinda new 2 access. so this myt b a basic question. but i cant figure this out.

talking about my problem...
I have a combo box where i have all my product names. according to that i want to update the other text boxes such as Qty on hand which are in the same form.
The problem i am having is when i navigate using the navigate buttons or by just prssing th tabs i can select the product name without any problem. but i have to go 1 by 1. and i added a new column in the products table as item code. and wen i let the user to find the product using the item code that works perfectly fine too.
when i try to select the product i want from the combo box it gives an error msg saying
"can't make the chanes u reqested. because it is creating a duplicate value in the primary key or indexes....blah blah blah"

why cant i select the product i want from the combo box???
 
Last edited:
Sound's like a problem with the set up of your Combo, but without seeing the structure of your DB it is going to be very difficult to give and exact diagnosis, and therefore a remedy.

Zip your DB (Access '03 as not everyone has '07) and post it here, and someone will be able to let you know what the problem is and how to fix it.
 
Actually these are also some possible reasons:


1. Is the form's AllowEdits property set to YES? If set to NO then you can't select in a combo.

2. Is the form's underlying recordsource updateable, if not then the combo won't be selectable (if it is bound to a field).

3. Is the combo's control source set to an expression? If so, you can't select anything.
 
Private Sub ComboP_Name_AfterUpdate()
Dim ActualQOH As Integer
ActualQOH = DLookup("QtyOnHand", "Products", "P_Name= '" & Forms![FormProducts]![ComboP_Name] & "'")
Debug.Print ActualQOH

End Sub



change your dlookup format to that above. see if that works
 
It still gives me the same error msg... t doesn't seem to be wrkn. any other solution??? Thanx
 
Having had a look at the DB, a couple of comments.

First up consider implementing a naming Protocol for your Objects ie. TBL_TableName, FRM_FormName, QRY_QueryName, and RPT_ReportName, this then makes it obvious what the object is when you refer to it in code or otherwise.

It tends to be easiest if you use the Auto number feature to assign Primary Keys such as ProductID or DepartmentID etc. then having done that be consistent in the use of that filed name. For example TBL_Department, D_No has a one to many relationship with TBL_Main, Department (D_No) and TBL_Products, P_Name has a similar relation ship with TBL_Main, Item (P_name).

Also you didn't mention which form it is that the problem is occurring on.
 
ohhh
the problem is occuring on the form "Products".
thanx for ur advices. will keep that in mind.
thanx
 
yes, you are using the pname combobox as your criteria. you cannot do this because this form is bound to products table and your pname combobox is bound also to pname field. especially your pname field is set to noduplicates.

I think you should make another combobox for that matter if you want it to be as your criteria or filter for your form datasource.
 
i dont know much about access. but den how can i select items wen i scroll my mouse scroll thing and wen i enter a number in the navigation bar below?? another combo??what shud b da source??? or areu asking me to try deletiing the existing combo and replacing it??? plz advice. i am clue less on this
 
lets disregard all that so that you wont be distracted.

The products form you have there is some sort for the purpose of updating the quantity on hand of your existing quantity on hand.

And you have a query AddQty as your update query.

Since you are using update query, we can remove the form record source to nothing so that it is not bounded that will eliminate your problem on duplicate records.

So to get the value of ActualQOH textbox we are going to use the afterupdate of your combop_name.

then we will use this code for your combop_name

Private Sub ComboP_Name_AfterUpdate()
Me.ActualQOH.Value = DLookup("[QtyOnHand]", "Products", "P_Name ='" & Forms![FormProducts]![ComboP_Name] & "'")
End Sub

I also noticed that the is error on your AddQty update query

lets also change the update query sql to:

UPDATE Products SET Products.QtyOnHand = [Forms]![formsProducts]![QOH]
WHERE (((Products.P_Name)=[Forms]![formProducts]![ComboP_Name]));

try and study it.
 
YESSSSS..... Thanx AccessProgram, John_Big_Booty and boblarson for the great support... i finally fixed it...thank u guys...thanx a heap for bearing with me and helping me out...:cool::cool::D:D:):)
 

Users who are viewing this thread

Back
Top Bottom