Sorry, it still asks for parameters when calling from VBA:ĭoCmd. Is this right? It is still giving msgbox for parametersĭoCmd.OpenForm "frmRules", WhereCondition:="QueryDate = ' 10:00 AM' AND Duration = 24 AND Rule = 2" There are 4 buttons on frmMain, each one will give different parameters, but parameters will be hardcoded (not from textbox or control on frmmain)
The OpenArgs property setting can then be used in code for the form, such as in an Open event procedure. To use the OpenArgs property, open a form by using the OpenForm method of the DoCmd object and set the OpenArgs argument to the desired string expression. I'm using a button on frmMain to open this frmRules. This property setting is read-only in all views. If i run the form manually, i can enter the 3 criteria (QueryDate as datetime, duration as integer and rule as integer) and get my result. Using Me.DateEntry will affect only the form in which it is coded, you cannot use Me. DoCmd.OpenForm FormName:'frmtimesheetheader', wherecondition:gstrwhereid, datamode:acFormedit. I created a form called frmRules that has the query as the recordsource. To override the forms property you can specify a datamode as shown below. To open the form, passing criteria:ĭoCmd.OpenForm "YourFormName", WhereCondition := "YourTextFieldName = '" & Me.txtbox1 & "' AND YourNumericField = " & Me.txtBox2 You can use Datasheet or Continuous forms view if you want a Instead, use a Form as a user interface, with your query in the recordsource property of the form. In general, you should avoid giving the users direct access to queries or tables.