D
D
Hi,
Although I have read the threads about getting data into a subform, I am
still getting this error. I am fairly new on access development and have not
used subforms yet.
Here is what I am trying to do:
1. On main form Timesheet_Entry, users enter an account number and a
contract number. Then press Get Details.
2. ONce pressed, subform Contractor_Rates_Subform will display the rates
associated with the contract and the contractor. I have a predefined qry that
has the main requirements for returned fields, the user entered fields will
adjust this query to display the details just for that contractor.
3. THe code I am using is as follows:
From main form:
Call Set_Rates(" WHERE (((CONTRACT.NUMBER)='" & contract_number & "') AND
((CONTRACTOR.ACCOUNT)='" & contractor_account & "'))")
Function Set_Rates(sql1 As String)
Dim original_sql As String
replace_sql = sql1
'modify the qry to select contractor rate details'
original_sql = qdf.SQL
sqlstring = original_sql
sqlstring = Replace(sqlstring, ";", replace_sql)
qdf.SQL = sqlstring
MsgBox (qdf.SQL)
' update the recordset for the subform'
'Form![Contractor_Rates_subform].Form.Visible = True'
'Me.Contractor_Rates_subform.SourceObject = qdf.SQL'
Me!Contractor_Rates_subform.Form.Recordset = qdf.SQL
'restore original query
qdf.SQL = original_sql
qdf.Close
End Function
I have clicked once on the control for the subform on the main form and it
appears the name of the control is Contractor_Rates_subform
but I get the error 2465 when I step through the code to the
Me!Contractor_Rates_subform.Form.Recordset = qdf.SQL.
Any advice
D
Although I have read the threads about getting data into a subform, I am
still getting this error. I am fairly new on access development and have not
used subforms yet.
Here is what I am trying to do:
1. On main form Timesheet_Entry, users enter an account number and a
contract number. Then press Get Details.
2. ONce pressed, subform Contractor_Rates_Subform will display the rates
associated with the contract and the contractor. I have a predefined qry that
has the main requirements for returned fields, the user entered fields will
adjust this query to display the details just for that contractor.
3. THe code I am using is as follows:
From main form:
Call Set_Rates(" WHERE (((CONTRACT.NUMBER)='" & contract_number & "') AND
((CONTRACTOR.ACCOUNT)='" & contractor_account & "'))")
Function Set_Rates(sql1 As String)
Dim original_sql As String
replace_sql = sql1
'modify the qry to select contractor rate details'
original_sql = qdf.SQL
sqlstring = original_sql
sqlstring = Replace(sqlstring, ";", replace_sql)
qdf.SQL = sqlstring
MsgBox (qdf.SQL)
' update the recordset for the subform'
'Form![Contractor_Rates_subform].Form.Visible = True'
'Me.Contractor_Rates_subform.SourceObject = qdf.SQL'
Me!Contractor_Rates_subform.Form.Recordset = qdf.SQL
'restore original query
qdf.SQL = original_sql
qdf.Close
End Function
I have clicked once on the control for the subform on the main form and it
appears the name of the control is Contractor_Rates_subform
but I get the error 2465 when I step through the code to the
Me!Contractor_Rates_subform.Form.Recordset = qdf.SQL.
Any advice
D