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

Double Click Syntax

Hello,
e a sub
I have created a database for my department, which will display all
the users details (name etc), PC details, and software details.
The database is just going to be a way of knowing who has what
installed on their PC and what PC they have.

I have 3 tables:
User table
Computer table
Software table

I have created forms for these table. In the Users form, I have a
subform that displays the a small amount of the computer details for
the relevant user.

What I'd like to do is, be able to Double Click on the PC name (or IP
address) field, and for it to then bring up the full details of the
computer in the computer form that I have created.

I am having problems getting the syntax right though in the VBA code.
My boss at my previous job set this part up for me, but now I wish I
asked what or how he did it.

I currently have this syntax, but it doesn't work.

If Me.PCName.ItemsSelected.Count 0 Then
DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = "
& Me.PCName.Value
End If
Any help on this would be much appreciated.

Thanks

Jeff

Jun 27 '07 #1
6 1774
For double click to work, you need to place it in the correct event in
VBA; for example, if the text box you would like to double click on is
called 'PC' then your code should be placed:

Private Sub PC_DblClick(Cancel As Integer)
<...your code...>
End Sub

You can also get to this point by entering on the form design view,
opening the properties of the text box and got to the events tab and
look for the double click event.

HTH - Max
Jun 27 '07 #2

"jeff" <ja***********@gmail.comwrote in message
news:11**********************@u2g2000hsc.googlegro ups.com...
Hello,
e a sub
I have created a database for my department, which will display all
the users details (name etc), PC details, and software details.
The database is just going to be a way of knowing who has what
installed on their PC and what PC they have.

I have 3 tables:
User table
Computer table
Software table

I have created forms for these table. In the Users form, I have a
subform that displays the a small amount of the computer details for
the relevant user.

What I'd like to do is, be able to Double Click on the PC name (or IP
address) field, and for it to then bring up the full details of the
computer in the computer form that I have created.

I am having problems getting the syntax right though in the VBA code.
My boss at my previous job set this part up for me, but now I wish I
asked what or how he did it.

I currently have this syntax, but it doesn't work.

If Me.PCName.ItemsSelected.Count 0 Then
DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = "
& Me.PCName.Value
End If
Any help on this would be much appreciated.

Thanks

Jeff
If ComputerID is text, you will need quotes around Me.PCName.Value.

DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = '" &
Me.PCName.Value & "'"
Jun 27 '07 #3
On Jun 27, 3:04 pm, "paii, Ron" <p...@pack.comwrote:
"jeff" <jazzy.jeff...@gmail.comwrote in message

news:11**********************@u2g2000hsc.googlegro ups.com...


Hello,
e a sub
I have created a database for my department, which will display all
the users details (name etc), PC details, and software details.
The database is just going to be a way of knowing who has what
installed on their PC and what PC they have.
I have 3 tables:
User table
Computer table
Software table
I have created forms for these table. In the Users form, I have a
subform that displays the a small amount of the computer details for
the relevant user.
What I'd like to do is, be able to Double Click on the PC name (or IP
address) field, and for it to then bring up the full details of the
computer in the computer form that I have created.
I am having problems getting the syntax right though in the VBA code.
My boss at my previous job set this part up for me, but now I wish I
asked what or how he did it.
I currently have this syntax, but it doesn't work.
If Me.PCName.ItemsSelected.Count 0 Then
DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = "
& Me.PCName.Value
End If
Any help on this would be much appreciated.
Thanks
Jeff

If ComputerID is text, you will need quotes around Me.PCName.Value.

DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = '" &
Me.PCName.Value & "'"- Hide quoted text -

- Show quoted text -
Thanks for your repsonses.

I am using the correct event/ text box.

I put the quotations around the text as mentioned, but I now get the
following text highlighted on my code.

..ItemsSelected

This the code that I have.

Private Sub PCName_DblClick(Cancel As Integer)
If Me.PCName.ItemsSelected.Count 0 Then
DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = '" &
"Me.PCName.Value" & "'"
End Sub

Any ideas on where to go from here?
Jun 27 '07 #4

"jeff" <ja***********@gmail.comwrote
I put the quotations around the text as mentioned, but I now get the
following text highlighted on my code.

.ItemsSelected

This the code that I have.

Private Sub PCName_DblClick(Cancel As Integer)
If Me.PCName.ItemsSelected.Count 0 Then
DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = '" &
"Me.PCName.Value" & "'"
End Sub

Any ideas on where to go from here?
Did you place the cursor on "ItemsSelected" and press F1 for Help? That
would be the first place to go for help.

If you do that, you'll find that the ItemsSelected property applies only to
multiselect List Boxes, which you did not indicate you are using. What type
of Control contains "PCName"?

Larry Linson
Microsoft Access MVP
Jun 27 '07 #5
On Jun 27, 4:03 pm, "Larry Linson" <boun...@localhost.notwrote:
"jeff" <jazzy.jeff...@gmail.comwrote
I put the quotations around the text as mentioned, but I now get the
following text highlighted on my code.
>
.ItemsSelected
>
This the code that I have.
>
Private Sub PCName_DblClick(Cancel As Integer)
If Me.PCName.ItemsSelected.Count 0 Then
DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = '" &
"Me.PCName.Value" & "'"
End Sub
>
Any ideas on where to go from here?

Did you place the cursor on "ItemsSelected" and press F1 for Help? That
would be the first place to go for help.

If you do that, you'll find that the ItemsSelected property applies only to
multiselect List Boxes, which you did not indicate you are using. What type
of Control contains "PCName"?

Larry Linson
Microsoft Access MVP
I did try this, but unfortunately I'm not sure where my colleagues
have the cd for the software, because it always prompts me to install
the help files when I try and do this.
I guess that's my next step though.

I'm not too sure what you mean by the type of control (i'm pretty new
to this side of access), but it is just a text box. There is no list
box.
Perhaps I need to use a different command to ItemsSelected?

Thanks for your help. I'll keep you posted.

Jun 27 '07 #6
The code you have was set up for use with a list box, rather than a text box
(the former being used just to select an item from a list, as opposed to
typing in the item, as in your case, with a text box).

To get the code to work with a text box, simply change the code as follows:

If Not IsNull(Me.PCName) Then
DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = '" &
Me.PCName & "'"
End If

Note that I removed the quotes around Me.PCName.Value and removed "Value".
The above should work fine with your text box, provided that you use a
ComputerID value (and not a computer name or other field associated with
computers). You should confirm that the ComputerID field is the value you're
entering/viewing in the text box.

If you want something more user-friendly, I'd recommend using a combo box.
The above code would work the same with a text box or combo box.

HTH,

Neil

"jeff" <ja***********@gmail.comwrote in message
news:11**********************@n60g2000hse.googlegr oups.com...
On Jun 27, 4:03 pm, "Larry Linson" <boun...@localhost.notwrote:
>"jeff" <jazzy.jeff...@gmail.comwrote
> I put the quotations around the text as mentioned, but I now get the
following text highlighted on my code.

.ItemsSelected

This the code that I have.

Private Sub PCName_DblClick(Cancel As Integer)
If Me.PCName.ItemsSelected.Count 0 Then
DoCmd.OpenForm "computerdetails", acNormal, , "ComputerID = '" &
"Me.PCName.Value" & "'"
End Sub

Any ideas on where to go from here?

Did you place the cursor on "ItemsSelected" and press F1 for Help? That
would be the first place to go for help.

If you do that, you'll find that the ItemsSelected property applies only
to
multiselect List Boxes, which you did not indicate you are using. What
type
of Control contains "PCName"?

Larry Linson
Microsoft Access MVP

I did try this, but unfortunately I'm not sure where my colleagues
have the cd for the software, because it always prompts me to install
the help files when I try and do this.
I guess that's my next step though.

I'm not too sure what you mean by the type of control (i'm pretty new
to this side of access), but it is just a text box. There is no list
box.
Perhaps I need to use a different command to ItemsSelected?

Thanks for your help. I'll keep you posted.

Jun 29 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Hattuari | last post by:
On page 32 of TC++PL SE is an example of a complex class as follows: class complex { double re, im; public: complex(double r, double i){re=r; im=i;} //... }; On page 262 of TC++PL SE is an...
6
by: Richard A. Lowe | last post by:
I'm using P/Invoke to call SendInput (using code culled from these newsgroups!) to send mouse events to a window. But I'm unsure how to send double-clicks. A VB6 article I saw on SendInput...
4
by: perspolis | last post by:
hi I manage a double click event in a combo box.. but this event doesn't fire ???? I don't know why??
3
by: Siv | last post by:
Hi, I have a ListView control in a Windows application, currently single clicking a customer name in this list, selects the customer and displays their details in text boxes to the right of the...
5
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event...
1
by: scott_gui | last post by:
Creating a Windows application: <Double-Button-1> mouse event has a conflict when there is also a binding to the <Button-1> event. It seems like a silly oversight that performing a double click...
2
by: scott_gui | last post by:
I am creating a Windows application: The mouse event <Double-Button-1> has a conflict when the <Button-1> event also has a binding. Double clicks will first perform the single click action. This...
9
by: Armando | last post by:
I have an app (A2000) where I am letting the user move an object on the screen. I use the OnClick for a command button event to modify the object's Top (or Left) properties, but you can only click...
4
by: Jeff User | last post by:
Hi Using .NET 1.1, C#, web app I (actually our client) would like to be able to double click a selection in a listbox and have it postback to server . There I would want to access the item that...
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.