I have a form with a list box whose control source is tblAccountDemographics. The row source for the table is as follows:
SELECT tblAccountDemographics.ID, tblAccountDemographics.[Account Name]
WHERE (((tblAccountDemographics.[Account Name])<"private pay"))
ORDER BY tblAccountDemographics.[Account Name];
The control source is Account Name. I am using the list box to open a report for the name clicked in the list box. In addition, there are two nonbound input boxes used for "Startdate" and "Enddate" to give a range of dates for the report. The code to open the report is behind a command button and as follows:
Dim strWhere As String
strWhere = "[account Name] = '" & Me.List2.Column(1) & "'" & _
" And ([Date] Between #" & Me.STARTDATE & "# And #" & Me.ENDDATE & "#)"
DoCmd.OpenReport "rptAccountInitial/CopyInvoice", acViewPreview, , strWhere
My problem is that when the form opens and is used it runs fine. No problems. Once the form is closed and reopened again, the first name/row in the table that gets changed from the Account Name to an arbitrary number, not necessarily the ID number that corresponds with the name being changed. Please note, this does not happen until after the form has been closed and reopenned.
To make matters worse, it changes the data in the underlying table called tbltimesheets that uses this table as a lookback table.
Any suggestions would be greatly appreciated.