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

Ihk

Member
Local time
Today, 09:54
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

  • Runtime Error 3061.accdb
    2.5 MB · Views: 194

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:54
Joined
May 7, 2009
Messages
19,170
you can use VBA to insert the records (see the Code on the Click event of your button).
 

Attachments

  • Runtime Error 3061.accdb
    2.5 MB · Views: 195
  • Love
Reactions: Ihk

Ihk

Member
Local time
Today, 09:54
Joined
Apr 7, 2020
Messages
280
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.
 

Ihk

Member
Local time
Today, 09:54
Joined
Apr 7, 2020
Messages
280
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:54
Joined
May 7, 2009
Messages
19,170
see the change in the code of the button again,
 

Attachments

  • Runtime Error 3061.accdb
    2.5 MB · Views: 184
  • Love
Reactions: Ihk

Users who are viewing this thread

Top Bottom