fluffyozzy
Registered User.
- Local time
- Today, 23:21
- Joined
- May 29, 2004
- Messages
- 63
Could someone help me please? I am trying to open two tables for comparing values. First table contains a number of records and I need to count how many records there are, depending on a field called QuoteID. Second table contains a field specifying the maximum number of records I can have on the first table with the same QuoteID. The limiting value is the QuoteID which is displayed on an active form.
I hope this makes sense...
I've been trying different things for hours but can't seem to get it to work. It gives me a "too few parameters" error, I have tried various approaches suggested in the forum but can't seem to be able to apply them to my problem.
Any help at all would be very much appreciated. Thank you!
I hope this makes sense...
I've been trying different things for hours but can't seem to get it to work. It gives me a "too few parameters" error, I have tried various approaches suggested in the forum but can't seem to be able to apply them to my problem.
Any help at all would be very much appreciated. Thank you!
Code:
Private Sub ProduceTheoryCmd_Click()
Dim intCountMCQBatch As Integer 'Count of number of current candidates for organisation
Dim intQuoteLimit As Integer 'The number of candidates allocated for current quote
Dim rst As Recordset 'Recordset for counting the number of papers already created for current quote
Dim rsta As Recordset 'Recordset for current quote limit
Set rst = CurrentDb.OpenRecordset("SELECT MCQBatchTbl.MCQBatchID, MCQBatchTbl.QuoteID FROM MCQBatchTbl WHERE MCQBatchTbl.QuoteID = Forms!MainFrm!QuoteID;")
Set rsta = CurrentDb.OpenRecordset("SELECT QuotesTbl.QuoteID, QuotesTbl.NoOfCands FROM QuotesTbl WHERE QuotesTbl.QuoteID = Forms!MainFrm!QuoteID;")
intCountMCQBatch = Nz(DCount("MCQBatchID", "MCQBatchTbl"), 0)
intQuoteLimit = QuotesTbl.NoOfCands
If intCountMCQBatch > intQuoteLimit Then
MsgBox "Number of papers allocated for the current quote has been reached"
Else
Call PrepMCQBatchID
Forms!MainFrm!MainHoldFrm.SourceObject = "MainHoldFrm"
End If
End Sub