Lookup not retrieving records (1 Viewer)

grane236

Registered User.
Local time
Today, 11:37
Joined
Nov 19, 2012
Messages
15
Hi,
I have a form which has fields connected to two tables.
I have a drop down which should return all fields from one table when an item is selected from the drop down
It worked in another form where I just had a text field but now I cannot get it to work with my dropdown.
Any advice appreciated:

Private Sub Combo135_BeforeUpdate(Cancel As Integer)
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.Combo135.Value
stLinkCriteria = "[Business Name]=" & "'" & SID & "'"
'Check StudentDetails table for duplicate StudentNumber
If DCount("Combo135", "Business Details", stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning business name " _
& SID & " already exists." _
& vbCr & vbCr & "You will now been taken to the business.", _
vbInformation, "Duplicate Information"
'Go to record of original business
rsc.FindFirst (stLinkCriteria)
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub
 

Users who are viewing this thread

Top Bottom