There's no fundsdata form in this version of the database
There is a fundsdata table howefver but your question implies a form
Are you talking about the form 'fromdataupdate' if so how do I navigate to that form using the buttons/controls on your main form?
If so there are a number of problems with the ON CLICK event of the UPDATE RECORDS button
1. You are adding 12 months every time you click it regardless of circumstance
2. You are cycling through items twice and you are not providing the proper context to update your data correctly
3. You SQL statement to perform the update is putting text markers (') around number fields, you YY field and your SponsorID field specifically
The way you are going with this relies on there to be only ONE possible combination of SponsorID/CounterpartyID
If that's the case what I would recommend is that when you access your data you limit the information to the Sponsor/Counterparty you're interested in using a Generated SQL statement like:
Code:
sSQL = "SELECT * FROM FundsData WHERE [SponsorID] = " & TxtHiddenSponsorID & " AND [YY] = " & TxtYYDataEntry & " AND [CounterpartyID] = " & CPList & " ORDER BY [MM]"
In other words you are only interested in looking at the data related to a specific sponsor, counterparty and year.
You can then count the records in this (you really only care if there is actually any data or not) using
Code:
if fd.recordcount = 0 then
'this is where you would add the 'basic' records if you are determined to do it the way you are currently
else
'this is where you would perform your updates of existing records, again using the combination of sponsor, counterparty, year and month
endif
finally I would switch your AFTER UPDATE event of your list box to the ON CLICK event, and instead of just populating the hiddensponsorID text box you also look up the values and populate the correct year/month fields on your form.