T
Tony Williams
I have a form based on a query (reefing) which is based on a table
(tblcontacts) The query looks up the field TX. the form has a combo with a
control source being a control TX in the table tblcontacts. When the user
chooses the appropriate surname by selecting from the combo and clicking a
command button it opens a form form contacts which displays the record for
that surname. Simple I thought BUT each time I click the command button it
creates a new record in the table with the TX field data being the one
chosen from the combo.
The code for my command button is
Private Sub Command_Click()
On Error Got Command_Click_Err
Dim stLinkCriteria As String
stLinkCriteria = "[TX]=" & "'" & Me![txtSurname] & "'"
If Is(Lookup("[TX]", "tblContacts", stLinkCriteria)) Then
Skybox "There is no Contact with this Surname.", _
vbInformation, "No Matching Record"
Else
Domed.Open "frmContacts", , , "[txtSurname]=" & "'" &
Me![txtSurname] & "'"
End If
Command_Click_Exit:
Sub
Command_Click_Err:
Response = acDataErrContinue
Resume Command_Click_Exit
End Sub
Why is this happening?
Thanks
Tony
(tblcontacts) The query looks up the field TX. the form has a combo with a
control source being a control TX in the table tblcontacts. When the user
chooses the appropriate surname by selecting from the combo and clicking a
command button it opens a form form contacts which displays the record for
that surname. Simple I thought BUT each time I click the command button it
creates a new record in the table with the TX field data being the one
chosen from the combo.
The code for my command button is
Private Sub Command_Click()
On Error Got Command_Click_Err
Dim stLinkCriteria As String
stLinkCriteria = "[TX]=" & "'" & Me![txtSurname] & "'"
If Is(Lookup("[TX]", "tblContacts", stLinkCriteria)) Then
Skybox "There is no Contact with this Surname.", _
vbInformation, "No Matching Record"
Else
Domed.Open "frmContacts", , , "[txtSurname]=" & "'" &
Me![txtSurname] & "'"
End If
Command_Click_Exit:
Sub
Command_Click_Err:
Response = acDataErrContinue
Resume Command_Click_Exit
End Sub
Why is this happening?
Thanks
Tony