473,322 Members | 1,690 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,322 software developers and data experts.

Conflicting List Boxes

13
I have 2 pop up forms which come from a main data entry form. The pop up forms are populated by a list box. When double clicking on the list, that entry is then pulled up on the main form.

My problem: I've gotten both sets of code to work - BUT NOT AT THE SAME TIME. It seams that they are conflicting for some reason - but now sure why. I think it may even be changing the code once I click on the DoCmd.Close. Not sure if I am going crazy!! Thoughts?? Below is the code...

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdShowActiveLeads_Click()
  2.  
  3. Dim rs As DAO.Recordset
  4. Set rs = Forms!frmLeadMain1.RecordsetClone
  5. 'Dim stLeadSearch As String
  6. 'stLeadSearch = "[Lead#']= "
  7.  
  8. Call rs.FindFirst("[Lead#] =" & Me.Ctl1stLead.Value)
  9. Forms!frmLeadMain1.Recordset.Bookmark = rs.Bookmark
  10. Call DoCmd.Close(acForm, "frmFindActiveLead")
  11.  
  12.  
  13. End Sub
  14.  
  15.  
  16. Private Sub List4_AfterUpdate()
  17.  
  18. Me.cmdShowActiveLeads.Enabled = True
  19.  
  20. End Sub
  21.  
  22.  
  23. Private Sub List4_DblClick(Cancel As Integer)
  24.  
  25. If Not IsNull(Me.List4.Value) Then
  26.     Call cmdShowActiveLeads_Click
  27.  
  28. End If
  29.  
  30. End Sub
  31.  
  32. Private Sub Command3_Click()
  33. On Error GoTo Err_Command3_Click
  34.  
  35.  
  36.     DoCmd.Close
  37.  
  38. Exit_Command3_Click:
  39.     Exit Sub
  40.  
  41. Err_Command6_Click:
  42.     MsgBox Err.Description
  43.     Resume Exit_Command3_Click
  44.  
  45. End Sub
  46.  
  47.  
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Private Sub cmdShowCurrentTenant_Click()
  4.  
  5. Dim rs As DAO.Recordset
  6. Set rs = Forms!frmLeadMain1.RecordsetClone
  7. 'Dim stLeadSearch As String
  8. 'stLeadSearch = "[Lead#']= "
  9.  
  10. Call rs.FindFirst("[Lead#] =" & Me.List4.Value)
  11. Forms!frmLeadMain1.Recordset.Bookmark = rs.Bookmark
  12. Call DoCmd.Close(acForm, "frmFindCurrentTenant")
  13.  
  14.  
  15. End Sub
  16.  
  17.  
  18. Private Sub List4_AfterUpdate()
  19.  
  20. Me.cmdShowCurrentTenant.Enabled = True
  21.  
  22. End Sub
  23.  
  24.  
  25. Private Sub List4_DblClick(Cancel As Integer)
  26.  
  27. If Not IsNull(Me.List4.Value) Then
  28.     Call cmdShowCurrentTenant_Click
  29.  
  30. End If
  31.  
  32. End Sub
  33.  
  34. Private Sub Command6_Click()
  35. On Error GoTo Err_Command6_Click
  36.  
  37.  
  38.     DoCmd.Close
  39.  
  40. Exit_Command6_Click:
  41.     Exit Sub
  42.  
  43. Err_Command6_Click:
  44.     MsgBox Err.Description
  45.     Resume Exit_Command6_Click
  46.  
  47. End Sub
  48.  
  49.  
Jan 26 '12 #1
5 1384
Rabbit
12,516 Expert Mod 8TB
What do you mean it's not working at the same time? I see multiple functions and I don't know which ones you mean.
Jan 26 '12 #2
isaace
13
for some reason when I click on the cmd close function; it copies the list box control in one of the form's modules to the other other form's module. (i.e it copies and Ctl1stLead to the other module and replaces all 'List4' functions with 'Ctl1stLead' even though that control is not existent in that form.) It only does this for the modules which contain a list box which both originate from the same main form. very weird....
Jan 26 '12 #3
Rabbit
12,516 Expert Mod 8TB
You're going to have to go into more detail. I have no idea what you mean by a listbox that originates from the same main form. And you mention functions for a control named Ctl1stLead but your code shows no such functions.
Jan 26 '12 #4
isaace
13
I have a main form with all leads. I created 2 pop up forms; each contain a list box. the first popup form, has a list box of 'hot leads'. the second pop up form has a list box of all leads which became customers. Upon opening any of the pop up forms, once I double click on a record in the list box (within the form), that record ([Lead#]) is pulled up on the main form. so there are 2 popup forms; each with 1 control; the list box. each list box has a different data source for separate queries. each form has its own vba code for pulling up that lead #(code is above). the problem is once I close one of the forms, it alters the vba code from the other form in that it copies and replaces only the list box control's name within the form vba module. have no idea why this is happening...very wierd...I assume it may have something to do with "DAO.Recordset" or the rs as I don't understand which either mean; I just copied that section of code from a textbook.

Does that help a bit??
Jan 27 '12 #5
Rabbit
12,516 Expert Mod 8TB
What do you mean it's replacing the VBA code? How do you know it's doing that?
Jan 27 '12 #6

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

Similar topics

0
by: Dwayne Gaddy | last post by:
Hey all, I have a windows form with a list boxes. I have data bound the list boxes with data from my sql database. I want to use drag and drop to allow users to choose different options from the...
2
by: chrisse_2 | last post by:
I currently have a form with a two text boxes and two list boxes. Now, i want the user to be able to type information into two of the text boxes and select an item from one of the list boxes; with...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
6
patjones
by: patjones | last post by:
Sometimes you might have two list boxes side by side, and want to double-click on an item in one box to move it to the other. For instance, maybe the first list box contains a list of customers,...
5
by: freddie1437 | last post by:
I have a big problem and would appreciate any help! I have an Access 2003 Database and I have forms in the database that have many list boxes. I only have one table that is a link and many queries...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
1
by: jmartmem | last post by:
Greetings, I have a nagging problem with client-side dynamic dependent list boxes that perhaps someone can help me troubleshoot. I have a form with a series of dynamic dependent list boxes....
2
by: hollinshead | last post by:
hi there, i have been having this issue for quite some time now and i cant seem to get my head around it. I am trying to create a database for candidates CV's and covering letters. basically the data...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.