Method 'item' of object 'forms' failed

BennyLinton

Registered User.
Local time
Yesterday, 20:02
Joined
Feb 21, 2014
Messages
263
I have a form "WorksheetList" that has a list of records upon which when one selects a record a new form opens "Worksheet" with the data from "WorksheetList" everything seemed to be working fine then suddenly I get the error "Method 'item' of object 'forms' failed"... any ideas? here's my code:

Private Sub txtReconciliationID_Click()
DoCmd.OpenForm "Worksheet", acNormal, , , , acWindowNormal
Forms![Worksheet]![txtLastUpdate] = Me.LastUpdate
Forms![Worksheet]![txtCalendarYear] = Me.CalendarYear
Forms![Worksheet]![txtPeriod] = Me.Period
Forms![Worksheet]![txtStatementBalance] = Me.StatementBalance
Forms![Worksheet]![txtDepositsInTransit] = Me.DepositsInTransit
Forms![Worksheet]![txtChangeOrdersInTransit] = Me.ChangeOrdersInTransit
Forms![Worksheet]![txtTotalAdditions] = Me.Additions
Forms![Worksheet]![txtTotalDeductions] = Me.Deductions
Forms![Worksheet]![txtCalculatedBankBalance] = Me.CalculatedBankBalance
Forms![Worksheet]![txtGeneralLedgerBalance] = Me.GeneralLedgerBalance
Forms![Worksheet]![txtPreparedBy] = Me.PreparedBy
Forms![Worksheet]![txtStatementDate] = Me.StatementDate
Forms![Worksheet]![txtApprovedBy] = Me.ApprovedBy
Forms![Worksheet]![txtGeneralLedgerDate] = Me.GeneralLedgerDate
Forms![Worksheet]![txtBadDebt] = Me.BadDebt
Forms![Worksheet]![txtBookedNotBanked] = Me.BookedNotBanked
Forms![Worksheet]![txtDifference] = Me.Difference
Forms![Worksheet]![txtUnidentifiedAdditions] = Me.UnidentifiedAdditions
Forms![Worksheet]![txtUnidentifiedDeductions] = Me.UnidentifiedDeductions
Forms![Worksheet]![txtUnmatchedBankDebits] = Me.UnmatchedBankDebits
Forms![Worksheet]![txtUnmatchedBankDebits] = Me.UnmatchedBankDebits
Forms![Worksheet]![txtMiscAdd1] = Me.MiscAdd1
Forms![Worksheet]![txtMiscAdd2] = Me.MiscAdd2
Forms![Worksheet]![txtMiscAdd3] = Me.MiscAdd3
Forms![Worksheet]![txtMiscAdd4] = Me.MiscAdd4
Forms![Worksheet]![txtMiscAdd5] = Me.MiscAdd5
Forms![Worksheet]![txtMiscAdd1Desc] = Me.MiscAdd1Desc
Forms![Worksheet]![txtMiscAdd2Desc] = Me.MiscAdd2Desc
Forms![Worksheet]![txtMiscAdd3Desc] = Me.MiscAdd3Desc
Forms![Worksheet]![txtMiscAdd4Desc] = Me.MiscAdd4Desc
Forms![Worksheet]![txtMiscAdd5Desc] = Me.MiscAdd5Desc
Forms![Worksheet]![txtAdditionsCalcd] = Me.AdditionsCalcd
Forms![Worksheet]![txtDeductionsCalcd] = Me.DeductionsCalcd
DoCmd.Close acForm, "WorksheetList"
End Sub
 
Maybe I am just being thick but I don't understand why you are using so much code to do this. from what I can tell, the record source is the same. So have one form that is a list (i.e. frmWorksheetList) that lists all the records. Then, have another form that shows all of the details (frmWorkSheet).

Then just use simple code to open the Worksheet form (DoCmd.OpenForm) and use the ID field in the WHERE to open it to the correct record.
 
BTW, use a split form for the worksheet list
 
So, when you click on ReconciliationID in WorksheetList your code will look like this:


Code:
DoCmd.OpenForm "frmWorksheet", , , "ReconciliationID=" & Me.ReconciliationID
DoCmd.Close acForm, "WorksheetList"
 
Thanks so much... I implemented your strategy and everything is working well! Benny
 

Users who are viewing this thread

Back
Top Bottom