Add more records in a specific form (1 Viewer)

aym

Registered User.
Local time
Today, 10:01
Joined
Aug 20, 2017
Messages
40
Hello good morning sir

Please sir I need your help, i design a database in MS access for a pharmaceutical shop. These are the field I have in my form
a. Name of drugs (in combo)
b. Quantity
c. Unit price
d. Total
e. Grand Total
Sir, if a customer bought more than one drugs how do i add more field in my form to add more?
e.g
*Name of drugs *Quantity *Unit Price *Total
1. Panadol 2 30 60

Please how do I add more Drug Name, Quantity, Unit price and Total either by clicking on a button. Thanks for your usual assistance
 

mike60smart

Registered User.
Local time
Today, 18:01
Joined
Aug 6, 2017
Messages
1,905
Hi

You would normally have Form where you select a Customer and then in a Continuous Subform you would have all of the various items on the Prescription.
 

vba_php

Forum Troll
Local time
Today, 12:01
Joined
Oct 6, 2019
Messages
2,880
the ideal way would prolly be 1 of 2 ways:

1) create a multi-select enabled listbox for "drug name", let the user select as many drugs as they want, write code to fill in the other field controls by looping through the listbox elements and looking up the related table information that is stored for each listbox item (or i spose you could use dloookup() function in the control source of the other textboxes that need their data from the listbox selections). then use another lookup method of ur choice to get the total from each drug selected and the quant * UP for another box, which would be an unbound control cuz calculated fields shouldn't be in tables. then run a query on the data when you need to show someone an order's line item totals and grand total. this would be a single listbox control and then some subform or something that would get its records added from the lookup code u write.

2) require the user to enter their multi-product order, one drug at a time by having them select one from the combo, populating the rest of the data, then putting a "save record" and "acGoToRecord" actions behind the button so they can enter more drug records. there's nothing wrong with this method, and i think Oracle does stuff like this. I remember when I used it there were always an insane amount of forms to use, one on top of the other, to do even the simplest of data entry tasks. so if Larry Ellison designs that way, then I'm sure you can to!

the ideal table for both of these scenarios would prolly be:

1) field1 > "drug name"
2) field2 > "quantity"
3) field3 > "unit price"

then when displaying order info to an inquirer, add a query field to the above 3:

1) field1 > "total price for this drug"
 

aym

Registered User.
Local time
Today, 10:01
Joined
Aug 20, 2017
Messages
40
Thanks for your response sir?

honestly am a beginner in Acess and am not that good sir am still a learner sir.

So I don't really understand your solutions sir

I would be glad if you will come down to my level sir
 

vba_php

Forum Troll
Local time
Today, 12:01
Joined
Oct 6, 2019
Messages
2,880
ok. that might take a long time to explain to u if you don't understand anything i said. so the first thing you might want to do is google search on simple tasks in access that i and mike have mentioned. but you might be able to pick up on it in the timeframe u need, and if that's the case, why don't you upload what you've got and someone can prolly give you a simple example of this. i already gave u the instructions on how to upload a file.

I'm outta here in an hour or so and won't be back until tomorrow, by which time u might have a solution, but i'll check back in with your progress with other people tomorrow. good luck to ya!
 
Last edited:

Cliff67

Registered User.
Local time
Today, 10:01
Joined
Oct 16, 2018
Messages
175
Hello Aym

If you are completely new to access and depending on your version, a chap called Steve Bishop has done a number of YouTube video to help with MS Acccess, he takes you right through from your first table up to programming in VBA have a look

https://www.youtube.com/watch?v=kogGwRIHH6o&list=PLYMOUCVo86jEeMMdaaq03jQ_t9nFV737s&index=1


These will give you loads of pointers as well as the video tutorials on the forum on the Right Hand panel. There are loads of other ones out there in YouTude to help as well as everyone here at the Access World Forum.

From what you are saying you need to change the underlying table to include the extra field name. Open your table in design view and add your new field. don't forget to define the data type.

You can then add the field name on to your form in the form design view by selecting Add Existing Fields

Hope that get you going
 

aym

Registered User.
Local time
Today, 10:01
Joined
Aug 20, 2017
Messages
40
Ok, thank you for the YouTube I really appreciate.
 

vba_php

Forum Troll
Local time
Today, 12:01
Joined
Oct 6, 2019
Messages
2,880
Ok, thank you for the YouTube I really appreciate.
let everyone here know if you still need help after learning from the video. try not to just disappear on us. :)
 

Users who are viewing this thread

Top Bottom