I'm having a problem with an SQL string that updates a field (RefPhysicianID) in the table TblPatientDemog raphics. The user navigates through a search, the results are displayed in a list box (in which the bound column is RefPhysicianID in TblRefPhysician), and the following code is used to update the field that links the records between two tables.
I'm getting a "too few parameters, Expected: 1" Error message. I find this odd because when I used
SET [RefPhysicianID] = Null
in my SQL String, it worked fine (updated the field to Null).
Any ideas on what I'm doing wrong?
Code:
Private Sub BtnSelectPhysician_Click()
If MsgBox("Assign physician to patient?", vbYesNo + vbQuestion) = vbYes Then
DoCmd.SetWarnings False
Dim strSQL As String
Dim db As DAO.Database
Set db = CurrentDb
strSQL = "UPDATE [TblPatientDemographics] " & _
"SET [RefPhysicianID] = Me.LbxPhysicianSearchResults " & _
"WHERE ([PtID] = "
strSQL = strSQL & [Forms]![FrmPatientDemographics].[PtID] & ")"
Call db.Execute(strSQL)
DoCmd.SetWarnings True
End If
End Sub
I'm getting a "too few parameters, Expected: 1" Error message. I find this odd because when I used
SET [RefPhysicianID] = Null
in my SQL String, it worked fine (updated the field to Null).
Any ideas on what I'm doing wrong?
Comment