Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / November 2005

Tip: Looking for answers? Try searching our database.

Why am I getting a new record with my search form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony Williams - 18 Nov 2005 10:33 GMT
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
Tony Williams - 18 Nov 2005 10:42 GMT
Sorry spellcheck played havoc with my posting here it is again:

I have a form based on a query (qryfind) which is based on a table
> (tblcontacts) The query looks up the field txtsurname. The form has a
> combobox with the control source being the field txtsurname in the table
[quoted text clipped - 30 lines]
> Thanks
> Tony

>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
[quoted text clipped - 31 lines]
> Thanks
> Tony
Declan - 18 Nov 2005 16:28 GMT
Make sure the "Data Entry" property of the form is set to "No".  If it is set
to "Yes", the form will only allow new records to be entered.  It looks to me
like there is something wrong with the form that's opened, not your code to
open it.  I would try creating a new form from scratch, even if it is a
simplified version of the old form, to isolate the problem and see if it's
the form or your code that opens the form that you are having trouble with.

> Sorry spellcheck played havoc with my posting here it is again:
>
[quoted text clipped - 69 lines]
> > Thanks
> > Tony
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.