G
Guest
I'm trying to add some data to a table with this command button code.
It hangs at: lID = GetNewID("tblLetterVals")
Says: Sub Function not defined
Could someone please help me define "GetNewID"
Private Sub ThankYou_Click()
Dim lCriteria As String
Dim lICCNNO As String
lICCNNO = Me!ICNNo
Dim lID As Long
lID = GetNewID("tblLetterVals")
lCriteria = "INSERT INTO tblLetterVals (ID, ICNNo, ProvNo)"
lCriteria = lCriteria & "SELECT " & lID & " AS ID,
tblQualityData.ICNNo, tblQualityData.ProvNo "
lCriteria = lCriteria & "FROM tblQualityData "
lCriteria = lCriteria & "WHERE (((tblQualityData.ICNNo)=" & """"
& lICCNNO & """" & "));"
DoCmd.RunSQL lCriteria
'Debug.Print lCriteria
DoCmd.SetWarnings True
DoCmd.GoToRecord , , acNewRec
It hangs at: lID = GetNewID("tblLetterVals")
Says: Sub Function not defined
Could someone please help me define "GetNewID"
Private Sub ThankYou_Click()
Dim lCriteria As String
Dim lICCNNO As String
lICCNNO = Me!ICNNo
Dim lID As Long
lID = GetNewID("tblLetterVals")
lCriteria = "INSERT INTO tblLetterVals (ID, ICNNo, ProvNo)"
lCriteria = lCriteria & "SELECT " & lID & " AS ID,
tblQualityData.ICNNo, tblQualityData.ProvNo "
lCriteria = lCriteria & "FROM tblQualityData "
lCriteria = lCriteria & "WHERE (((tblQualityData.ICNNo)=" & """"
& lICCNNO & """" & "));"
DoCmd.RunSQL lCriteria
'Debug.Print lCriteria
DoCmd.SetWarnings True
DoCmd.GoToRecord , , acNewRec