Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form / subform problems

Status
Not open for further replies.

malbreht

Technical User
Dec 8, 2006
63
SI
Hi!

I created a subform, so that I will be able to asign not just one item to an employee at a time. (description and tables at the very bottom of
My main form is
Code:
frmPurchase (Purchase_ID, Date, Year, Bill_No, Employee_ID, Name, Telephone, Mail)
and its subform
Code:
frmPurchase_subform (PurhaseProduct_ID, Product_ID, Name, Price, Quantity, Price*Quantity, Cancel)

Problem No.1: When I try to asign more than one product in the subform, everything works.* But when exiting the main form and opening it again, there isn't only 1 purchase with 5 products, but rather 5 purchases! The tables are correct, though.

For instance,tblPurchaseProduct:
PurhaseProduct_ID Purchase_ID Product_ID Price Quantity Cancel
1 1 9999 80,00€ 1 Yes
2 1 9999 80,00€ 1 No
3 1 9999 80,00€ 1 No
4 1 9999 80,00€ 1 No
5 1 9999 80,00€ 1 No
(This is ok for me, since I'm able to cancel only 1 item)


Problem No.2: The Employee_ID in my main form is a combo and became I-don't-know-why** the first highlighted field in my form, although the TAB index is only fifth... It's essential that the first highlighted field is the one with TAB index = 1, that is Year.

I'm stuck again, please help... Thank you very much!
Mare

_________________________________________
*It's about the same product. Because I need to be able to cancel only one product, I can't simply enter e.g. 5 items in the Quantity field, but copy-paste the whole row in the subform for 4 times. Is there any procedure, that would copy-paste a row as many times as a user would enter?

** It's a FindAsYouType combo - is that the reason?
 
Don't quite understand problem 1.

Problem2 - you are most likely setting the focus to the combo in whatever routine you are using to populate it. 'On current' event maybe ...

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
The first problem is realy hard to explain better - but I'll try my best:

When I make a purchase for 1 employee, I asign him 1 product in a subform. But the quantity of this product could be more than 1. If I simply type 5 in the Quantity field, I am unable to cancel only 1 quantity of this item - I can only cancel the whole quantity of this product.

That's why I type quantity = 1 and copy-paste this row as many times as needed. So 1 purchase has many records with the same Product_ID.** That seems to be the problem, but I can't figure it why...if you look at my tables, that shouldn't be a problem - or am I wrong?


**As like this:
For instance,tblPurchaseProduct:
PurhaseProduct_ID Purchase_ID Product_ID Price Quantity Cancel
1 1 9999 80,00€ 1 Yes
2 1 9999 80,00€ 1 No
3 1 9999 80,00€ 1 No
4 1 9999 80,00€ 1 No
5 1 9999 80,00€ 1 No

The second problem:the code for this form is among others:
Code:
Public faytCombo As FindAsYouTypeCombo

Dim bWasNewRecord As Boolean 'and other Call lines for the Allen Browne's Audit Log

Private Sub Form_Open(Cancel As Integer)

    DoCmd.GoToRecord , , acNewRec
    Set faytCombo = New FindAsYouTypeCombo
    Set faytCombo.FilterComboBox = Me.Employee_ID
    faytCombo.FilterFieldName = "Employee_ID"

End Sub

It worked fine before switching to subform ... any ideas why?

Thank you so much,
mare
 
How are ya malbreht . . .

Instead of deleting a product with a quantity of 5 [blue]you should be updating the quantity (subtracting as necessary) until you hit zero at which time you delete the product![/blue]

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 

completely and totally off the bean, but might I thank Mr. AceMan for his [bold]"how are ya"[/bold] intro?

What a totally cool/nice/polite way to say hey to a nother net travellor. Civillity should rule.

How ever followers you have, add one
Don

[green]Tis far easier to keep your duck in a row if you just have the one.[/green]
 
MallardVHS . . .

Thankyou very much! [wavey]

[blue]You take care! . . . Ya Hear![/blue] [thumbsup2]

Calvin.gif
See Ya! . . . . . .
 
...you should be updating the quantity (subtracting as necessary) until you hit zero...

Eee, this is exactly what I need, but how do I do that? Any link?

Thank you very much!

Mare
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top