By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,486 Members | 2,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,486 IT Pros & Developers. It's quick & easy.

select items

lee123
100+
P: 556
is there a way to have a product form (that has items you can choose from) and a Orderdetail form to add the items to with a button to select these items and when selected add to the orderdetail form. anotherwords, if you have a product form with items in it you could highlight the items then click a save or select button and add the items you have selected in an orderdetail subform. because right now i am using a combo box with the items in it and it addes it to the orderdetail form but i want to be a little more advanced. you know.

lee123
Sep 9 '07 #1
Share this Question
Share on Google+
16 Replies


JKing
Expert 100+
P: 1,206
Have you thought about trying a list box instead of combo box so you can select multiple items?
Sep 10 '07 #2

lee123
100+
P: 556
you know I haven't. But that sound cool. how would you go about doing that? Please explain.

lee123
Sep 10 '07 #3

JKing
Expert 100+
P: 1,206
It would be quite similar to using a combo box. A list box is much the same except you can select more than one value. There is an option within access to convert a combo box into a list box. Once you've made your combo box into a listbox set the multi-select property to extended.

In code you can iterate through the selected items by using the ItemsSelected collection.

This will print the data in the bound column for each selected row in the immediate window.
Expand|Select|Wrap|Line Numbers
  1. Dim varItem As Variant
  2.  
  3.     For Each varItem In Me.List4.ItemsSelected
  4.         Debug.Print Me.List4.ItemData(varItem)
  5.     Next
  6.  
Sep 10 '07 #4

lee123
100+
P: 556
well I tried that but i still want to know if my first question is possible? can it be done? and if so how can i do it.

lee123
Sep 10 '07 #5

JKing
Expert 100+
P: 1,206
I guess I don't really understand what you are looking for.

From what I gathered from your first form you want a list of products. On click of a button you want them added to a seperate form as an order.

In what way do you plan on presenting the list of products? I suggested a listbox because it's simply that, a list.
Sep 11 '07 #6

lee123
100+
P: 556
Ok lets see, well the list box takes up too much room for the items i have in the product form. . picture this, you have an order form. with a orderdetail subform in it the order form has your basic customer detail. like po #, orderdate, duedate, etc. in the subform(orderdetail) you have Qty, items(product), unitprice. etc. in the orderdetail form i have put a combo box. named it product combo (in the property box) with no controlsource and put this code behind it:

Expand|Select|Wrap|Line Numbers
  1. Private Sub ProductCombo_AfterUpdate()
  2.  
  3. Docmd.GoToRecord, , acNewRec
  4. ProductID = Productcombo.Column(0)
  5. Description = ProductCombo.Column(1)
  6. UnitPrice = ProducCombo.Column(2)
  7.  
  8. End Sub
In the combo box i can drop it down and pick what ever i want and it goes in the orderdetail subform. but. ( here's My question) Instead of haveing a drop down box that i can pick from. i would like to just have a form (product form). that i can select (Highlight) the items and have a button in the (product form) that after you have selected them(items) click the button and saves the item in memory and when you get to the ( orderdetail) sub form drop them in with another button(Add) i guess that makes sense. if it can't be done then i'll live with the combo box i have now. thanks

Lee123
Sep 11 '07 #7

Denburt
Expert 100+
P: 1,356
From what I gather I would say to stay along the same lines of JK although in your order form you would use a button. Click the button and it would hide the order form and a products form shows up with the list of products. Select the products and click a button on that form it would then add those products to the orders form and problem solved.
Sep 12 '07 #8

NeoPa
Expert Mod 15k+
P: 31,186
JKing,

I looked but didn't really understand the question. If I ever find the question is expressed clearly then I will return.
Sorry I couldn't help.
Sep 12 '07 #9

lee123
100+
P: 556
one more time. this is getting frustrating. ok look i have four forms ok. one form for the customer. one form for the order. and one form for the products and i have a form that is the orderdetail form, but i have made the orderdetail form a subform on the order form ok! Now in my orderdetail form i have a combo box that holds all the items from the product table so when i drop down the combo box it list everything in the product table. if i have anything that is not in the list i can add it to the combo box.

(Question):

How can i make a separate form that is a continous form with all the products. from the product table.select several items at one time. have a button that save the items i have selected and drop them in the orderdetail sub form at once.

Wait. i just realized something in my previous questions i have said or reffered my product table as a form ( my bad ).


(What i don't want):

I don't want a combo box to add the items or a list box
Sep 13 '07 #10

NeoPa
Expert Mod 15k+
P: 31,186
Lee,

You've obviously tried so I have read your last post carefully and I think I get what you mean.
Unfortunately, what you want is quite complicated to deal with as it is not supported natively by Access. This means going into coding country I'm afraid (If anyone has a better, more supported, method then please ignore this).

Continuous forms are difficult to work with as you would probably want to tag (somehow mark) the items on the form. This is a tricky part as a bound control means each marked item would update the underlying table, and an unbound control is hard to reference from the code. Marking the product table would immediately cause problems in any sort of multi-user application so is not a good route to travel. I will see if I can determine how to reference individual unbound controls in a repeating section of a continuous form. I know it's tricky. Another alternative is to add each item to the order as it is flagged (a bit like clicking a button for each required one in the list really). This is probably going to be the best approach for you.

After flagging the items I presume you would want to click a button which would cause these items to be added to the current order. I'm not sure how you intend to add other relevant info such as quantity etc.

I suggest that adding items (probably not fully qualified with quantities etc) directly into your OrderDetail table is probably not a good idea and a temporary table might be a safer option (likely to throw up fewer data inconsistencies).

Does this sound like the level of work / effort that you could envisage getting involved in?
I can't see a simpler approach.
Sep 13 '07 #11

NeoPa
Expert Mod 15k+
P: 31,186
It turns out that referring to flags (unbound control) on individual lines is actually impossible. Although it shows the control in each record, the value is only stored once and trying to flag any individual record will simply flag them all.

It seems that the only way to go about this is to have a command button (or any other trigger device) add the current record and you would select all the products you need one by one from this form. A command button within the detail section will repeat itself on the continuous form, but it will select that record automatically, perhaps saving at least one step in the process.
Sep 13 '07 #12

lee123
100+
P: 556
Hey NeoPa, thanks for reading my question, You know i thought i would have to draw pictures because it would probably be the only way i could explain it. Ha ha.

I read your last response and i all for trying anything so if you could tell me how this can be done or what i need on what form it would be for trying.

I know in visual basic you can do what i have explained i think. i thought access you could too. but i guess i was wrong. but i'll try what you say if you can explain it to me.

thanks
lee123
Sep 13 '07 #13

NeoPa
Expert Mod 15k+
P: 31,186
Well Lee,

I don't want to get too heavily involved in your project as it is, after all, your project.
I'm happy to explain certain aspects in more detail if that's required, but this is likely to be quite complicated so I will need to respond to your questions rather than pitch the whole thing at you again at a level that makes sense to you. I have no way of knowing what that level would need to be.

Remember, we on this side of the fence, are at quite a disadvantage as we can't see your databases or many of the details of your problems. We rely entirely on what you tell us. Anything you overlook - we don't get to know about. If your explanation is made up of half-formed sentences that don't actually make literal sense, that can be very confusing too.
In natural speech with someone who can see your face and pick up various clues that is less critical. In a technical forum it can make the difference between an answer and being ignored.

Back to the question.
Let me know what you understand and what you need help with. If you don't understand what I'm talking about at this stage it's probably better that we don't attempt this. It does rely on both parties having a rudimentary understanding at least of the principals. I will give the matter some thought anyway while I await your response.
Sep 14 '07 #14

lee123
100+
P: 556
well i understand, It was a thought i thought could be done and your right explaining the problem or project did take awhile but now that i know what i'm looking at i'll just stay with what i have instead of changing it but thanks for getting back with me

lee123
Sep 14 '07 #15

NeoPa
Expert Mod 15k+
P: 31,186
You're welcome Lee.
It's funny how some ideas can seem quite simple but when you get down to looking at them in detail they're much more complicated. I think this is one of those. Not impossible, but certainly not a simple one anyway.
Good luck with your project.
Sep 16 '07 #16

lee123
100+
P: 556
yea you too for your help.

lee123
Sep 16 '07 #17

Post your reply

Sign in to post your reply or Sign up for a free account.