Hi Guys,
Ok...this problem looks like it might be harder to xplain than it may actually be to solve it, so pls bear with me.
I have a FrmEnquiry on a tab page. Related to it, and on the 2nd tab page is FrmQuotation. Now, one Enquiry can have many Quotations associated with it(i.e Client may refuse 1st Quote, so a second one would be created.)Once a Quotation is finally accepted a Yes/No Accepted box is ticked.Still with me??? Ok, heres where it gets complicated;
I'm having problems coming up with a code that will do the following; go through all Quotation records in tblQuote that have the current Enquiry number, and select the record whos' Accepted field = True, then set this as the current record of FrmQuotation. In this way, the user will not need to go through all Quotations records to loacte the one that was accepted.
Began to come up with this but....
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * FROM Quote WHERE Accepted = True AND Enquiry_Id = " & Me.Enquiry_Id, dbOpenDynaset)
If .NoMatch Then
Beep
MsgBox "The record cannot be found in the source of this form!"
Exit Sub
Else
Forms![Enquiry].Bookmark = .Bookmark ‘ set forms record to display rst
End If
Can anybody pls help??
Ok...this problem looks like it might be harder to xplain than it may actually be to solve it, so pls bear with me.
I have a FrmEnquiry on a tab page. Related to it, and on the 2nd tab page is FrmQuotation. Now, one Enquiry can have many Quotations associated with it(i.e Client may refuse 1st Quote, so a second one would be created.)Once a Quotation is finally accepted a Yes/No Accepted box is ticked.Still with me??? Ok, heres where it gets complicated;
I'm having problems coming up with a code that will do the following; go through all Quotation records in tblQuote that have the current Enquiry number, and select the record whos' Accepted field = True, then set this as the current record of FrmQuotation. In this way, the user will not need to go through all Quotations records to loacte the one that was accepted.
Began to come up with this but....
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * FROM Quote WHERE Accepted = True AND Enquiry_Id = " & Me.Enquiry_Id, dbOpenDynaset)
If .NoMatch Then
Beep
MsgBox "The record cannot be found in the source of this form!"
Exit Sub
Else
Forms![Enquiry].Bookmark = .Bookmark ‘ set forms record to display rst
End If
Can anybody pls help??