Password.zip
Hi all,
DB attached.
On Form (frmOnLineAccess) when I enter a new name into field Search Institutions, it fire a Not in List, which it is suposed to, and When save it put an ID into the Website Field?
Has something to do with the code below in RED but not sure why it is putting it in both the InstitutionID and the Website? Should only go in the InstitutionID in the corresponding table.
Baffles me, maybe someone will see what the problem is on this. I think Valid helped me with this a long time ago and I never have been able to fix it?
Code:
Private Sub CboInstitutionSearch_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim maxID As Long
On Error Resume Next
If MsgBox("Institution is not in Current List, Would you Like to Add?", vbYesNo) = vbNo Then
Me.Undo
Me.CboInstitutionSearch = Null
Response = acDataErrContinue
Exit Sub
End If
strSQL = "Insert Into tblInstitution ([InstitutionName]) values ('" & NewData & "')"
CurrentDb.Execute strSQL, dbFailOnError
CurrentDb.Execute "INSERT INTO tblOnLineAccess(InstitutionID) VALUES(" & CurrentDb.OpenRecordset("SELECT @@IDENTITY").Fields(0) & ")"
Response = acDataErrAdded
Me.CboInstitutionSearch = Null
Me.Requery
Me.TxtWebsite.SetFocus
maxID = DMax("InstitutionID", "tblInstitution")
Me.RecordsetClone.FindFirst "Institution=" & maxi
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Thank you
Dave