pbuethe
Returning User
- Local time
- Today, 02:17
- Joined
- Apr 9, 2002
- Messages
- 210
This error message “cannot add record; primary key for table 'tlkpReview' not in recordset” appears on selecting from combobox cboDecision when entering a new record. This has been working with the table in Access (in the previous version of this database), but the error started appearing when we moved the backend to SQL Server.  The code is as follows:
	
	
	
		
The error message occurs on the line Me.txtLevel = “PRA”. The primary key of tlkpReview is CaseNbr + ReviewLevel. CaseNbr is selected from another combobox on the form. The control txtLevel is bound to ReviewLevel. The record source of the form is qryCases:
  
	
	
	
		
qrySearchFields:
	
	
	
		
Thanks for your help.
 
		Code:
	
	
	Private Sub cboDecision_AfterUpdate()
If IsNull(Me.[cboCaseID]) Then
  MsgBox " Please select a case first."
  Me.[cboDecision] = Null
  Exit Sub
Else
  Me.txtLevel = "PRA"
  Me.[txtDecision] = Trim(Me.[cboDecision])
  Me.ReviewDate = Now
  Me.[ReviewStaff] = Me.[txtUser]
  Me.Refresh
  If Me.cboDecision.Value = "Referral" Then
     Me.cmdOpenReferral.Visible = True
  Else
     Me.cmdOpenReferral.Visible = False
  End If
  
End If
End SubThe error message occurs on the line Me.txtLevel = “PRA”. The primary key of tlkpReview is CaseNbr + ReviewLevel. CaseNbr is selected from another combobox on the form. The control txtLevel is bound to ReviewLevel. The record source of the form is qryCases:
		Code:
	
	
	SELECT qrySearchFields.CaseNbr, qrySearchFields.SampleNbr, qrySearchFields.Provider, qrySearchFields.PatientName, qrySearchFields.MedRecNbr, qrySearchFields.MedicaidID, qrySearchFields.Gender, qrySearchFields.DOB, qrySearchFields.AdmitDate, qrySearchFields.DischDate, qrySearchFields.ProviderNbr, qrySearchFields.ProviderName, qrySearchFields.CUID, qrySearchFields.ReviewLevel, qrySearchFields.Outcome, qrySearchFields.ReviewDate, qrySearchFields.ReviewStaff, qrySearchFields.Password, qrySearchFields.FileName
FROM qrySearchFields
WHERE (((qrySearchFields.SampleNbr)=[Forms]![frmPRAReview]![cboSampleNbr]) AND ((qrySearchFields.ProviderNbr)=[Forms]![frmPRAReview]![cboProvider]));qrySearchFields:
		Code:
	
	
	SELECT tblWkshtHeader.CaseNbr, tblWkshtHeader.SampleNbr, tblWkshtHeader.Provider, tblWkshtHeader.PatientName, tblWkshtHeader.MedRecNbr, tblWkshtHeader.MedicaidID, tblWkshtHeader.Sex AS Gender, tblWkshtHeader.DOB, tblWkshtHeader.AdmitDate, tblWkshtHeader.DischDate, tblWkshtHeader.ProviderNbr, tblWkshtHeader.ProviderName, tblWkshtHeader.CUID, tblWkshtHeader.Password, tlkpReview.ReviewLevel, tlkpReview.Outcome, tlkpReview.ReviewDate, tlkpReview.ReviewStaff, tlkpReview.DataEntry, tlkpReview.EntryDate, tblCaseList.FileName, tlkpReview.EntryStaff, tlkpReview.LetterSent, tlkpReview.LetterDate, tlkpReview.LetterStaff
FROM (tblWkshtHeader LEFT JOIN tlkpReview ON tblWkshtHeader.CaseNbr = tlkpReview.CaseNbr) LEFT JOIN tblCaseList ON tblWkshtHeader.CaseNbr = tblCaseList.CaseID; 
	 
 
		 
 
		 
 
		 
 
		