Run Time error 3075 in Insert query

atrium

Registered User.
Local time
Tomorrow, 10:47
Joined
May 13, 2014
Messages
348
The full error message is - Runtime error 3075
Invalid use of '.','!', or '0', in query expression 'Forms.TrustReconAll BranchesFrm.[AcctNameFld'.

Below is the code
Code:
INSERT INTO TrustReconRptTemp ( BranchName, AcctName, BSBandAccountNo, DayEnded, LedgerAmount, UnprocessedDeposits, UnprocessedWithdrawals, UnpresentedCheques, UnpresentedDeposits, ExpectedLedgerAmount, BankStatementAmount, Discrepancy, Adjustments, AdjustedTrustLedgerAmount, CompletedBy, CompletedDate )
VALUES (Forms.TrustReconAllBranchesFrm.[BranchNameFld], Forms.TrustReconAllBranchesFrm. [AcctNameFld], Forms.TrustReconAllBranchesFrm.[BSBandAccountNoFld], Forms.TrustReconAllBranchesFrm.[DayEndedFld], Forms.TrustReconAllBranchesFrm.[LedgerAmountFld], Forms.TrustReconAllBranchesFrm.[UnprocessedDepositsFld], Forms.TrustReconAllBranchesFrm.[UnprocessedWithdrawalsFld], Forms.TrustReconAllBranchesFrm.[UnpresentedChequesFld], Forms.TrustReconAllBranchesFrm.[UnpresentedDepositsFld], Forms.TrustReconAllBranchesFrm.[ExpectedLedgerAmountFld], Forms.TrustReconAllBranchesFrm.[BankStatementAmountFld], Forms.TrustReconAllBranchesFrm.[DiscrepancyFld], Forms.TrustReconAllBranchesFrm.[AdjustmentsFld], Forms.TrustReconAllBranchesFrm.[AdjustedTrustLedgerAmountFld], Forms.TrustReconAllBranchesFrm.[CompletedByFld], Forms.TrustReconAllBranchesFrm.[CompletedDateFld]);

I have checked the code a 100s times and still cant see where my problem is.

I need new eyes and an open mind
 
Code:
With CurrentDb.CreateQueryDef("", _
"INSERT INTO TrustReconRptTemp ( BranchName, AcctName, BSBandAccountNo, DayEnded, LedgerAmount, UnprocessedDeposits, UnprocessedWithdrawals, UnpresentedCheques, UnpresentedDeposits, ExpectedLedgerAmount, BankStatementAmount, Discrepancy, Adjustments, AdjustedTrustLedgerAmount, CompletedBy, CompletedDate ) " & _
"VALUES (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, P14, P15, P16);")
    .Parameters("p1") = Forms!TrustReconAllBranchesFrm![BranchNameFld]
    .Parameters("p2") = Forms!TrustReconAllBranchesFrm![AcctNameFld]
    .Parameters("p3") = Forms!TrustReconAllBranchesFrm![BSBandAccountNoFld]
    .Parameters("p4") = Forms!TrustReconAllBranchesFrm![DayEndedFld]
    .Parameters("p5") = Forms!TrustReconAllBranchesFrm![LedgerAmountFld]
    .Parameters("p6") = Forms!TrustReconAllBranchesFrm![UnprocessedDepositsFld]
    .Parameters("p7") = Forms!TrustReconAllBranchesFrm![UnprocessedWithdrawalsFld]
    .Parameters("p8") = Forms!TrustReconAllBranchesFrm![UnpresentedChequesFld]
    .Parameters("p9") = Forms!TrustReconAllBranchesFrm![UnpresentedDepositsFld]
    .Parameters("p10") = Forms!TrustReconAllBranchesFrm![ExpectedLedgerAmountFld]
    .Parameters("p11") = Forms!TrustReconAllBranchesFrm![BankStatementAmountFld]
    .Parameters("p12") = Forms!TrustReconAllBranchesFrm![DiscrepancyFld]
    .Parameters("p13") = Forms!TrustReconAllBranchesFrm![AdjustmentsFld]
    .Parameters("p14") = Forms!TrustReconAllBranchesFrm![AdjustedTrustLedgerAmountFld]
    .Parameters("p15") = Forms!TrustReconAllBranchesFrm![CompletedByFld]
    .Parameters("p16") = Forms!TrustReconAllBranchesFrm![CompletedDateFld]
    .Execute
End With
 
Looks to me like there is a space between the form name and the field name:

Code:
Forms.TrustReconAllBranchesFrm. [AcctNameFld]

Was that a copy/paste of the actual code or a retype? If copy/paste, then that space got you.
 
Thank you The_Doc_Man So simple it beat me

Thanks again(y)
 
And it could have been - but I had to ask.
 

Users who are viewing this thread

Back
Top Bottom