473,386 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

New "Blank" Record Added When Search Runs

I have two forms with one calling the other to perform searches. When I run the search form the 2nd form a blank record is added to my table. The table is appended or updated from entries on the first form but the second form doesn’t reference the table at all. The queries ran from the form obviously query the table for data but these are not the same queries that update/append.

Any ideas what would cause this to happen?

As always, any help would be greatly appreciated.

Thanks,
Doug
Jun 12 '08 #1
5 1503
puppydogbuddy
1,923 Expert 1GB
Doug,
Check the property sheet for the second form and make sure data entry is set to No. If that doesn't fix it, then please post the code sub that you use to open the second form.

PDB
Jun 12 '08 #2
Here is the Code for the 2nd form:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CboTitleSearch_AfterUpdate()
  2.     Me![TxtTitleSearch] = Me![CboTitleSearch].Column(1)
  3. End Sub
  4.  
  5. Private Sub cboPublisherSearch_AfterUpdate()
  6.     Me![TxtPublisherSearch] = Me![CboPublisherSearch].Column(1)
  7. End Sub
  8.  
  9. Private Sub CmdSearch_Click()
  10. On Error GoTo Err_CmdSearch_Click
  11.         Dim stTitle As String
  12.         stTitle = "Records_Search_Query"
  13.  
  14.         CboTitleSearch.SetFocus
  15.         Me![CboTitleSearch] = ""
  16.         subfrmTitleSearch.Visible = True
  17.         LblTitleResults.Visible = True
  18.         Forms![Records_Search]![subfrmTitleSearch].Requery
  19.  
  20. Exit_CmdSearch_Click:
  21.     Exit Sub
  22.  
  23. Err_CmdSearch_Click:
  24.     MsgBox Err.Description
  25.     Resume Exit_CmdSearch_Click
  26.  
  27. End Sub
  28.  
  29. Private Sub CmdPublisherSearch_Click()
  30. On Error GoTo Err_CmdPublisherSearch_Click
  31.  
  32.     Dim stPublisher As String
  33.     stPublisher = "Publisher_Records_Search"
  34.  
  35.     CboPublisherSearch.SetFocus
  36.     Me![CboPublisherSearch] = ""
  37.     subfrmPubSearch.Visible = True
  38.     lblPubResults.Visible = True
  39.     Forms![Records_Search]![subfrmPubSearch].Requery
  40.  
  41. Exit_CmdPublisherSearch_Click:
  42.     Exit Sub
  43.  
  44. Err_CmdPublisherSearch_Click:
  45.     MsgBox Err.Description
  46.     Resume Exit_CmdPublisherSearch_Click
  47.  
  48. End Sub
  49.  
  50. Private Sub cmdSubmitted_Click()
  51. On Error GoTo Err_cmdSubmitted_Click
  52.  
  53.      If Me![txtSubmissions] = "Yes" Then
  54.         Dim stSubmitted As String
  55.         stSubmitted = "Records_Search_Submitted"
  56.      End If
  57.  
  58.     subfrmSubmissions.Visible = True
  59.     lblSubResults.Visible = True
  60.     Forms![Records_Search]![subfrmSubmissions].Requery
  61.  
  62. Exit_cmdSubmitted_Click:
  63.     Exit Sub
  64.  
  65. Err_cmdSubmitted_Click:
  66.     MsgBox Err.Description
  67.     Resume Exit_cmdSubmitted_Click
  68. End Sub
  69.  
  70. Private Sub CmdUnsubmitted_Click()
  71. On Error GoTo Err_CmdUnsubmitted_Click
  72.  
  73.      If Me![txtSubmissions] = "No" Then
  74.         Dim stUnsubmitted As String
  75.         stUnsubmitted = "Records_Search_Unsubmitted"
  76.      End If
  77.  
  78.      subfrmUnsubmitted.Visible = True
  79.      lblSubResults.Visible = True
  80.      Forms![Records_Search]![subfrmUnsubmitted].Requery
  81.  
  82. Exit_CmdUnsubmitted_Click:
  83.     Exit Sub
  84.  
  85. Err_CmdUnsubmitted_Click:
  86.     MsgBox Err.Description
  87.     Resume Exit_CmdUnsubmitted_Click
  88.  
  89. End Sub
  90.  
  91. Private Sub CmdCancelSearch_Click()
  92. On Error GoTo Err_CmdCancelSearch_Click
  93.  
  94.     Me![CboTitleSearch] = ""
  95.     Me![CboPublisherSearch] = ""
  96.     Me![TxtTitleSearch] = ""
  97.     Me![TxtPublisherSearch] = ""
  98.  
  99. Exit_CmdCancelSearch_Click:
  100.     Exit Sub
  101.  
  102. Err_CmdCancelSearch_Click:
  103.     MsgBox Err.Description
  104.     Resume Exit_CmdCancelSearch_Click
  105.  
  106. End Sub
  107. Private Sub CmdClearForm_Click()
  108. On Error GoTo Err_CmdClearForm_Click
  109.  
  110.     Me![CboTitleSearch] = ""
  111.     Me![CboPublisherSearch] = ""
  112.     Me![TxtTitleSearch] = ""
  113.     Me![TxtPublisherSearch] = ""
  114.     Me![txtSubmissions] = ""
  115.     CboTitleSearch.SetFocus
  116.     subfrmTitleSearch.Visible = False
  117.     LblTitleResults.Visible = False
  118.     subfrmPubSearch.Visible = False
  119.     lblPubResults.Visible = False
  120.     subfrmSubmissions.Visible = False
  121.     subfrmUnsubmitted.Visible = False
  122.     lblSubResults.Visible = False
  123.     RadNo = False
  124.     RadYes = False
  125.  
  126. Exit_CmdClearForm_Click:
  127.     Exit Sub
  128.  
  129. Err_CmdClearForm_Click:
  130.     MsgBox Err.Description
  131.     Resume Exit_CmdClearForm_Click
  132.  
  133. End Sub
  134.  
  135. Private Sub RadNo_Click()
  136.     cmdSubmitted.Visible = False
  137.     CmdUnsubmitted.Visible = True
  138.     CmdUnsubmitted.SetFocus
  139.     Me![txtSubmissions] = "No"
  140.     RadYes = False
  141.  
  142. End Sub
  143.  
  144. Private Sub RadYes_Click()
  145.     CmdUnsubmitted.Visible = False
  146.     cmdSubmitted.Visible = True
  147.     cmdSubmitted.SetFocus
  148.     Me![txtSubmissions] = "Yes"
  149.     RadNo = False
  150.  
  151. End Sub
  152. Private Sub cmdExit_Click()
  153. On Error GoTo Err_cmdExit_Click
  154.  
  155.  
  156.     DoCmd.Close
  157.  
  158. Exit_cmdExit_Click:
  159.     Exit Sub
  160.  
  161. Err_cmdExit_Click:
  162.     MsgBox Err.Description
  163.     Resume Exit_cmdExit_Click
  164.  
  165. End Sub
  166.  
Here are the SQL statements for each query called in thie above code

Records_Search_Query
Expand|Select|Wrap|Line Numbers
  1. SELECT Created_Submitted.Title, Created_Submitted.[Year Created], Created_Submitted.Submitted, Created_Submitted.[Submitted To], Created_Submitted.Website, Created_Submitted.Type, Created_Submitted.Accepted, Created_Submitted.[Date Submitted], [Date Entered]
  2. FROM Created_Submitted
  3. WHERE (((Created_Submitted.Title)=Forms!Records_Search!TxtTitleSearch));
  4.  
Publisher_Records_Search
Expand|Select|Wrap|Line Numbers
  1. SELECT Created_Submitted.[Submitted To], Created_Submitted.Title, Created_Submitted.[Date Submitted], Created_Submitted.Type, Created_Submitted.Accepted
  2. FROM Created_Submitted
  3. WHERE Forms!Records_Search!TxtPublisherSearch=(Created_Submitted.[Submitted To])
  4. GROUP BY Created_Submitted.[Submitted To], Created_Submitted.Title, Created_Submitted.[Date Submitted], Created_Submitted.Type, Created_Submitted.Accepted;
  5.  
Records_Search_Submitted
Expand|Select|Wrap|Line Numbers
  1. SELECT Created_Submitted.Title, Created_Submitted.[Year Created], Created_Submitted.Submitted, Created_Submitted.[Submitted To], Created_Submitted.Website, Created_Submitted.Type, Created_Submitted.Accepted, Created_Submitted.[Date Submitted], Created_Submitted.[Date Entered]
  2. FROM Created_Submitted
  3. WHERE (((Created_Submitted.Submitted)="yes"))
  4. GROUP BY Created_Submitted.Title, Created_Submitted.[Year Created], Created_Submitted.Submitted, Created_Submitted.[Submitted To], Created_Submitted.Website, Created_Submitted.Type, Created_Submitted.Accepted, Created_Submitted.[Date Submitted], Created_Submitted.[Date Entered];
  5.  
Records_Search_Unsubmitted
Expand|Select|Wrap|Line Numbers
  1. SELECT Created_Submitted.Title, Created_Submitted.[Year Created], Created_Submitted.Submitted, Created_Submitted.[Submitted To], Created_Submitted.Website, Created_Submitted.Type, Created_Submitted.Accepted, Created_Submitted.[Date Submitted], Created_Submitted.[Date Entered]
  2. FROM Created_Submitted
  3. WHERE (((Created_Submitted.Submitted)="no"))
  4. GROUP BY Created_Submitted.Title, Created_Submitted.[Year Created], Created_Submitted.Submitted, Created_Submitted.[Submitted To], Created_Submitted.Website, Created_Submitted.Type, Created_Submitted.Accepted, Created_Submitted.[Date Submitted], Created_Submitted.[Date Entered];
  5.  
Anything you can tell me would be greatly appreciated. I have searched online but not really found anything good.

Thanks,
Doug

Doug,
Check the property sheet for the second form and make sure data entry is set to No. If that doesn't fix it, then please post the code sub that you use to open the second form.

PDB
Jun 12 '08 #3
puppydogbuddy
1,923 Expert 1GB
Doug,
I don't have the time to study all that code in detail, but it looks to me that the second form you refer is really a subform. In that case, they go together like bread and butter.....when a main form record is created, so will the subform be created. No so if you are using 2 forms. Suggest that you download sample forms (includes an example of a form w/subform, and an example of 2 forms working in synchronized fashion) from this link:

http://support.microsoft.com/kb/233324
Jun 12 '08 #4
Its actaully a form with some subforms on it. I'll check out the link.

Thanks

Doug,
I don't have the time to study all that code in detail, but it looks to me that the second form you refer is really a subform. In that case, they go together like bread and butter.....when a main form record is created, so will the subform be created. No so if you are using 2 forms. Suggest that you download sample forms (includes an example of a form w/subform, and an example of 2 forms working in synchronized fashion) from this link:

http://support.microsoft.com/kb/233324
Jun 12 '08 #5
I have this fixed. Turns out it was two things. One the form was not set with the proper data source. Second, the query was not setup properly. Once I change those two things it stopped adding the blank record.

Thanks for the help.

Its actaully a form with some subforms on it. I'll check out the link.

Thanks
Jun 13 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: John Baker | last post by:
Hi: I have a query which supports a form. Te form is used to edit, update and change records in the table the query is based on. It all works fine EXCEPT that the "New" record (blank updatable...
4
by: Tim | last post by:
I have used a graphic 'next record' button on a form. How can I stop it from going past the last existing record? In other words, I don't want it to take the user to a blank record. Thanks Tim
1
by: John | last post by:
Hi I need to print "blank" invoices with invoice numbers only at the top. I have a table full of invoice numbers which I am using as the record source for the invoice report. I have placed the...
1
by: James Pang | last post by:
myProcess.StartInfo.FileName==@"C:\WINDOWS\system32\ping.exe 10.0.0.1"; //this will not work cant find file name... myProcess.StartInfo.FileName==@"C:\WINDOWS\system32\ping.exe"; //this works...
1
by: jyoti202 | last post by:
Hi, Need help for this as i have been looking for it but could not get any results. We are using java as front end and DB2 as backend, i m getting the exception while executing a particular...
4
by: sid | last post by:
"about:blank" oepns new browser window I am writing a webpage that will run on other machines that I may or may not know about. My page is framed where frame1 controls the content of frame2. ...
1
by: sid | last post by:
I am writing a webpage that will run on other machines that I may or may not know about. My page is framed where frame1 controls the content of frame2. What I have found is that if the page in...
0
by: crankeboy | last post by:
Hi Folks, My setup: Visual Studio Express 2008, VC++, .NET, BitBlt Here is a summary of the problem: - I am trying to copy a bitmap of my main form into a picture box. - To do this, I bitblt...
7
kcdoell
by: kcdoell | last post by:
Good morning everyone: I created a form and set the default view as a continuous form. Basically the form is displaying records in which the user can add or edit new ones. The record source for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.