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

On Dbl Click function

I have created a Form with two list boxes.....One contains State/Branches that have not been completed and a second list box that has State/branches that have been completed. Basically, has two list boxes are next to each other with no duplicates in both. They utilize the same same table and have a third column as a boolean Yes/No(completed). What I was thinking was if I double clicked on a particular State/Branch in the not completed list that it would automatically update my Completed column as yes and move it over to the other list box and vice versus. Is this possible? Also, would i have to create the two list boxes as a subform or are two listboxes ok? Any help would be greatly appreciated.
Sep 23 '08 #1
5 1944
ADezii
8,834 Expert 8TB
This most certainly can be accomplished, and here is the General Template, assuming the Primary Key in your Table is the Bound Column for cboNotCompleted:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboNotCompleted_DblClick(Cancel As Integer)
  2. Dim strSQL As String
  3. strSQL = "Update <Your Table Name> Set <Your Table Name>.[Completed] = True Where <Your Table Name>.[<Primary Key>] = " & Me![cboNotCompleted] & ";"
  4. CurrentDb.Execute strSQL, dbFailOnError
  5.  
  6. Me![cboCompleted].Requery
  7. Me![cboNotCompleted].Requery
  8. End Sub
Sep 23 '08 #2
hjozinovic
167 100+
You could use Column Property for this too.
This would require that your Combo-boxes are based on a queries that include three columns in this order: State;Branches;Completed (Completed being third)
And column widths property of comboboxes must be set to e.g.: 2;2;0
(Zero for third column)
And column count property must be set to: 3

On Double click event of cboCompleted put:
Expand|Select|Wrap|Line Numbers
  1. Me!cboCompleted.Column(2) = No
  2. Me!cboCompleted.Requery
  3. Me!cboNotCompleted.Requery
On Double click event of cboNotCompleted put:
Expand|Select|Wrap|Line Numbers
  1. Me!cboNotCompleted.Column(2) = Yes
  2. Me!cboCompleted.Requery
  3. Me!cboNotCompleted.Requery
Sep 24 '08 #3
I have been playing with this for an hour now and can not figure it out. Here is my VB Code that I updated the information from my table:
Private Sub cboNotCompleted_DblClick(Cancel As Integer)
Dim strSQL As String
strSQL = "Update Sample_Branches Set Sample_Branches.[Completed] = True Where Sample_Branches.[Sample_ID] = " & Me![cboNotCompleted] & ";"
CurrentDb.Execute strSQL, dbFailOnError
Me![cboCompleted].Requery
Me![cboNotCompleted].Requery
End Sub

In my Form, List2 Box My Row Source is such:
SELECT Sample_Branches.ST, Sample_Branches.BR, Sample_Branches.Completed, Sample_Branches.Sample_ID
FROM Sample_Branches
WHERE (((Sample_Branches.Completed)=Yes));
and Vice versus =No for List4 box
Under Propertiese I have Column Count as 4, Coulmn Heads=Yes,Column Widths=1,1,0,0; Bound Column=4.

Do you see what I am doing wrong?

Matt
Sep 24 '08 #4
ADezii
8,834 Expert 8TB
I have been playing with this for an hour now and can not figure it out. Here is my VB Code that I updated the information from my table:
Private Sub cboNotCompleted_DblClick(Cancel As Integer)
Dim strSQL As String
strSQL = "Update Sample_Branches Set Sample_Branches.[Completed] = True Where Sample_Branches.[Sample_ID] = " & Me![cboNotCompleted] & ";"
CurrentDb.Execute strSQL, dbFailOnError
Me![cboCompleted].Requery
Me![cboNotCompleted].Requery
End Sub

In my Form, List2 Box My Row Source is such:
SELECT Sample_Branches.ST, Sample_Branches.BR, Sample_Branches.Completed, Sample_Branches.Sample_ID
FROM Sample_Branches
WHERE (((Sample_Branches.Completed)=Yes));
and Vice versus =No for List4 box
Under Propertiese I have Column Count as 4, Coulmn Heads=Yes,Column Widths=1,1,0,0; Bound Column=4.

Do you see what I am doing wrong?

Matt
Substitute List2 and List4 for my cbo examples.
Sep 24 '08 #5
Substitute List2 and List4 for my cbo examples.
Wow, worked like a charm. Your the best.

Matt
Sep 24 '08 #6

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

Similar topics

1
by: zoltix | last post by:
Hi, I am beginner in JavaScript. I would like to intercept all click events on my document. I use this function for that document.onmousedown=click;. It works well. But I would like to...
7
by: Paul Cooper | last post by:
Dear All, I am working on a piece of Javascript code that needs to detect a mouse-click, shift-click and control-click. The code is not my own - it is a part of a much larger suite of routines....
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
1
by: Drew | last post by:
I would like to find out how to build a click counter using VB.NET. This is not a run-of-the-mill click counter (i.e. for web use), but a novelty app that counts how many times you click...
24
by: John Gabriel | last post by:
CreateDialogIndirect() fires my Radio button click function without the radio button having being clicked. I am using VC++ 2003.NET. I believe this is yet another Microsoft bug. Have checked dialog...
11
by: yangsuli | last post by:
i want to creat a link when somebody click the link the php script calls a function,then display itself :) i have tried <a href=<? funtion(); echo=$_server ?>text</a> but it will call the...
6
by: Jim Devenish | last post by:
I have an unbound form that displays all the days of the year as a calendar. It has 12 rows of text boxes with either 29,30 or 31 in each row. Text box names are of the form: display_01_01,...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
1
by: \Ji Zhou [MSFT]\ | last post by:
Hello Jason, Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou and I will be working on this issue with you. I have tried to but cannot reproduce your issue on my side....
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.