Lookup not working (1 Viewer)

musclecarlover07

Registered User.
Local time
Today, 15:12
Joined
May 4, 2012
Messages
236
I have a simple database that I need help with a Dlookup issue. Basically this database is used as a tracker for Pie in the face. You put the players name in then you put how much money is placed on that person. So far everything in this aspect works. I have a secondary sheet "Sheet1" This has how much each vote is. So 1 vote $.25. When you give a $1 you get 5 votes. So you cane never get 4 votes. Sheet 1 is my look up sheet. I need help with the DLookup. When I put an amount in the "AmountAdd" field then hit "Add" button I need it to look up how many votes and keep a running total of how many votes were placed in the "TotalVotes" field. I keep getting a data mismatch error.

This is not the final product. This is something threw together real quick while testing. The actual copy is being used. I did not make a backup copy.
 

Attachments

  • Database4.accdb
    624 KB · Views: 71

plog

Banishment Pending
Local time
Today, 16:12
Joined
May 11, 2011
Messages
11,645
Why do you have TotalVotes and TotalCollected as Text fields? Also why are you storing this--it seems like a calculated field, you should instead just make a query to determine this and not store the value.
 

musclecarlover07

Registered User.
Local time
Today, 15:12
Joined
May 4, 2012
Messages
236
In the actual Database TotalCollected is currency. I dint think to change it here because it wasn't being used in the current issue. TotalVotes I always had as a text field. I didn't think it would make much diffenece either way. Well I only have it store because there are more players. So they want the Total collected visible. I was a able to get a copy of the actual one. I wasnt able to get ahold of the person earlier.
 

Attachments

  • Pie In The Face.zip
    245.4 KB · Views: 68

musclecarlover07

Registered User.
Local time
Today, 15:12
Joined
May 4, 2012
Messages
236
So I actually figured it out.
Original Code:
Code:
Forms!Main!TotalVotes = DLookup("Price", "Pricing", "Price =" & Me.AmountAdd) + Forms!Main!TotalVotes
Changed:
Code:
Forms!Main!TotalVotes = DLookup("Votes", "Pricing", "Price =" & Me.AmountAdd) + Forms!Main!TotalVotes

It works. I just had it looking in the wrong column. This was annoying.:banghead:
 

Users who are viewing this thread

Top Bottom