Solved Run time error 3061, too few parameter expected 4., If query has filter based on form control values

Ihk

Member
Local time
Today, 07:46
Joined
Apr 7, 2020
Messages
280
I have Form sourced from query with 3 filtered based on Form value.
Filters on form are
1) combo1 value
2) combo 2 value
3) date start and date end
and para meters in query are
Code:
[Forms]![MainFormWithQuery1]![cboCompany]
Between [Forms]![MainFormWithQuery1]![txtStartDate] And [Forms]![MainFormWithQuery1]![txtEndDate]
[Forms]![MainFormWithQuery1]![cboCategory]

As far as these filters are concerned, those are working fine and record is filtered. However if I run query record update command then I get this error.
Quick and dirty sample database attached.
MainForm has two buttons linking to
Form1 based on query (with filters) and has update problem --- filter work fine but update query does not.
Form2 based on query (without filters) and update query has no problem.. works fine.
Click on Save button on Form1 and Form2 to see difference.
Thanks
 

Attachments

you can use VBA to insert the records (see the Code on the Click event of your button).
 

Attachments

  • Love
Reactions: Ihk
you can use VBA to insert the records (see the Code on the Click event of your button).
You are great man and very intellecutal and very helping. a lot of love for you. Thank you very much. Kind regards.
 
In Post#2 sample db @arnelgp , (talking about MainForm - button on left side , opens new form whic has filters)
how to put a stop for the main form (not to update / not to go for new record), if subform is empty, it has no records.
Because subform record appears only after applying filters.
In current situation the main form goes for new record if we press save button, without confirming subform records. thanks
 

Users who are viewing this thread

Back
Top Bottom