Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

NOT ABLE TOPLUG IN

  Asked By: Kuhaylah    Date: Oct 27    Category: MS Office    Views: 623
  

I am stuck with this thing in my project work , the
full coding really put me out of trouble.

There are two contents in table receiptno and deno
The user will ask in a textbox how much he require

We have to extract the deno,receiptno of the total
asked by user.

I have tried it with re.movenext,rs.moveprevious but
it seems
there is some lacuna which I AM NOT ABLE TOPLUG IN

Receipt No Deno SUM
R1 50 R1 220
R1 50 R2 220
R1 100 R3 500
R1 20 R4 300
R2 100 R5 150
R2 20 1390
R2 100
R3 500
R4 100
R4 100
R4 100
R5 50
R5 100
1390

CASE-I
Input 200


CASE-II 300
Input


CASE-III 1340
Input

Share: 

 

9 Answers Found

 
Answer #1    Answered By: Amir Hashmi     Answered On: Oct 27

This is the same query you already posted. I still don't understand - as
I said the last time - what all the 'CASE' business at the bottom means
- you're going to have to explain that. Also, to the right of the list,
you have totals. Are these calculated already?

Exactly what is the user  inputting and what do you want to return as a
result of it?

 
Answer #2    Answered By: Jarryd Williams     Answered On: Oct 27

I just don't get this. Maybe I'm just having a dumb day. Can anyone else
in the group see what he's getting at?

 
Answer #3    Answered By: Kate Johnston     Answered On: Oct 27

I am regular watching this group from last 2-3 months
and it seems that you are the person who solves most
of the queries . I will once again try to put  my
problem.

A) I have got
Receipt No. Denomination
R1 50
R2 100
R3 100


I want that if option in a text box being given to
user
for feeding any no. say 200. The result should show
Receipt no Denomination
R2 100
R3 100


Basically it should first check :

If val(text1.text) < first field then
it should move to next field and add previous one
and goes in loop unless finds the sum of deno=text
field.


I am quite hopeful that you will solve my problem.

Do revert back if you still have any doubt about my
required output.

 
Answer #4    Answered By: Gavril Bonkob     Answered On: Oct 27

OK. I think I'm getting there, but I foresee a few problems. For
instance, in your example, how does the code reject the first item of
50? Until it looks further down the list, It can't tell that using this
won't give it an exact usage of the 200 amount, will it?

 
Answer #5    Answered By: Lula Woods     Answered On: Oct 27

It will go to first record and as per the example if
it reads 50 which is less than 200 asked by user  it
moves on next record adds previous 50+new record 100
which makes it 150 (stores it in a variable).

*******every time it stores add value in variable
before moving on next record

It again checks the condition (with stored variable)
which is still < 200.

moves to next records add 100+150 (variable stored)
which makes 250 which is > 200 .
Now it search for 200 in reverse direction(ie. from
last to first record). As soon as it founds the right
combination it will show those records and leaves 50
out.

I know it is bit cumbersome but I am quite sure it is
workable .

I am clear about the logic but needs from scratch the
coding and I am sure I can get it from you.

 
Answer #6    Answered By: Fayina Bonkob     Answered On: Oct 27

OK. What if the user  enters 180????????

 
Answer #7    Answered By: Fabian Ferrrari     Answered On: Oct 27

Just an observer of this problem. I would liken it to a check book with an
overdraft condition. If overdrawn by 500 what combination of checks issued
and outstanding would minimize the OD charges or the opposite condition what
combiniation would maximize it. It seems my bank uses a logic of
maximization!
I would summarize totals for each receipt first, then sort the receipts in
decending order. Cycle down the list with the first less than or equal to
OD. Repeat until total satisfied.

 
Answer #8    Answered By: Fabian Jones     Answered On: Oct 27

It will display a messgage saying that the amt asked
is not available.
Message like :

msgbox "The amt entered does not exist"

 
Answer #9    Answered By: Clariss Ferrrari     Answered On: Oct 27

In that case, you're asking the code to do quite a complex job and it
seems like you'd have to do quite a few sums to determine there wasn't a
fit; there's lots of algorithms and evaluation here. I'd suggest you
hire a professional programmer; this type of 'best fit' algorithm can
take a pro days to get working.

Now I've said that, perhaps someone on the list will prove me wrong.

 
Didn't find what you were looking for? Find more on NOT ABLE TOPLUG IN Or get search suggestion and latest updates.




Tagged: