Hi guys,
What I have is a Job List form where a user clicks on a QuoteNumber fieldwhich then opens the Customers form based on the CustomerID.
This is done by:
This works fine.
On the Customers form I have 2 sub forms being a datasheet JobDataSheet which has all the jobs allocated to the customer and JobForm which is the detail of the selected job from JobDataSheet.
What I would like the above on click to jump to the job in JobDataSheet where the QuoteNumber is found in the record and subsequently populate the JobForm with the details of the record.
I am using the following to no avail:
A couple of problems with it.
1. It doesnt do what its supposed to do!
It opens the Customers form but doesnt go to the appropriate record.
2. If I then close the Customer form I get a Runtime error 2450 - Microsoft Access cannot find the reference form Customers
Any ideas?
What I have is a Job List form where a user clicks on a QuoteNumber fieldwhich then opens the Customers form based on the CustomerID.
This is done by:
Code:
Private Sub QuoteNumber_Click()
DoCmd.OpenForm "Customers", acNormal, , "CustomerID=" & Me.CustomerID, acFormEdit, acDialog
End Sub
This works fine.
On the Customers form I have 2 sub forms being a datasheet JobDataSheet which has all the jobs allocated to the customer and JobForm which is the detail of the selected job from JobDataSheet.
What I would like the above on click to jump to the job in JobDataSheet where the QuoteNumber is found in the record and subsequently populate the JobForm with the details of the record.
I am using the following to no avail:
Code:
Private Sub QuoteNumber_Click()
DoCmd.OpenForm "Customers", acNormal, , "CustomerID=" & Me.CustomerID, acFormEdit, acDialog
'Dim Variables
Dim rst As Recordset
Dim strSearchName As String
'Set recordSet
Set rst = Forms!Customers.JobDataSheet.Form.RecordsetClone
'assign QuoteNUmber to variable
strSearchName = Str(Me.QuoteNumber)
'find QuoteNumber
rst.FindFirst "QuoteNumber = " & strSearchName
'if no match found then go to first record otherwise go to the job that matches the quote number
If rst.NoMatch Then
DoCmd.GotoRecord acDataForm, Forms!Customers.JobDataSheet, acFirst
Else
Forms!Customers.JobForm.Form.Bookmark = rst.Bookmark
End if
rst.close
Set rst = Nothing
End Sub
A couple of problems with it.
1. It doesnt do what its supposed to do!
2. If I then close the Customer form I get a Runtime error 2450 - Microsoft Access cannot find the reference form Customers
Any ideas?