Hello there,
I have tried all day but in vain....here is the problem:
Form1: there are 50 labels (so far, the number is subject to change), each
label caption is a fruit or a vegetable, for example, label1's caption is
apple, label2's caption is banana, label3 citron, etc.
Form2: one textbox txt0.
Action: double click label1, open Form2 and fill txt0 "apple",
double click label2, open Form2 and fill txt0 "banana",
double click label3, open Form2 and fill txt0 "citron" etc.
Is is possible, How to do it?
Thank you.
Paul from Slovakia 4 5841
On Thu, 23 Sep 2004 19:48:39 GMT, Paul T. Rong wrote: Hello there,
I have tried all day but in vain....here is the problem:
Form1: there are 50 labels (so far, the number is subject to change), each label caption is a fruit or a vegetable, for example, label1's caption is apple, label2's caption is banana, label3 citron, etc.
Form2: one textbox txt0.
Action: double click label1, open Form2 and fill txt0 "apple", double click label2, open Form2 and fill txt0 "banana", double click label3, open Form2 and fill txt0 "citron" etc.
Is is possible, How to do it?
Thank you.
Paul from Slovakia
In the Double-click event of each of the labels on form1:
DoCmd.OpenForm "Form2"
forms!Form2!Tex t0 = Me![Labelx].Caption
where the x in Labelx is the label number double-clicked.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Thank you, fred
but I would like to some other way. because there are 50 labels (and the
number is subject to change according to the user), I can not to make it
manually in your way 50 times or even more.
Is it possible to by vba
1. to select all labels
2. to write in their "double click" property something like "=labelclic k"
3. to add something like:
Private Function labelclick()
dim labelcap as string
' what is needed here is a vba function to get back the value of the
caption of the label we just double clicked
Docmd.OpenForm "Form1"
Forms![Form1].txt0 = labelcap
End Function
this is what i thought, anybody can help?
many thanks,
Paul
Bratislava, Slovakia
"fredg" <fg******@examp le.invalid>
??????:14****** *************** *******@40tude. net... On Thu, 23 Sep 2004 19:48:39 GMT, Paul T. Rong wrote:
Hello there,
I have tried all day but in vain....here is the problem:
Form1: there are 50 labels (so far, the number is subject to change),
each label caption is a fruit or a vegetable, for example, label1's caption
is apple, label2's caption is banana, label3 citron, etc.
Form2: one textbox txt0.
Action: double click label1, open Form2 and fill txt0 "apple", double click label2, open Form2 and fill txt0 "banana", double click label3, open Form2 and fill txt0 "citron" etc.
Is is possible, How to do it?
Thank you.
Paul from Slovakia
In the Double-click event of each of the labels on form1: DoCmd.OpenForm "Form2" forms!Form2!Tex t0 = Me![Labelx].Caption
where the x in Labelx is the label number double-clicked.
-- Fred Please only reply to this newsgroup. I do not reply to personal email.
"Paul T. Rong" <et***@hotmail. com> wrote in message
news:Tc******** *************@n ews.chello.at.. . Thank you, fred
but I would like to some other way. because there are 50 labels (and the number is subject to change according to the user), I can not to make it manually in your way 50 times or even more.
Is it possible to by vba
1. to select all labels 2. to write in their "double click" property something like "=labelclic k" 3. to add something like:
Private Function labelclick() dim labelcap as string
My favorite way to add function to multiple controls of the same type
is through a class using WithEvents.
<clsLabelCaptio n>
Option Compare Database
Option Explicit
Private WithEvents m_label As Access.Label
Private m_targetForm As String
Public Sub init(lbl As Access.Label, formName As String)
m_targetForm = formName
Set m_label = lbl
m_label.OnDblCl ick = "[Event Procedure]"
End Sub
Private Sub m_label_DblClic k(Cancel As Integer)
DoCmd.OpenForm m_targetForm, acNormal, , , , , m_label.Caption
End Sub
</clsLabelCaption >
<calling form code>
Option Compare Database
Option Explicit
Dim colFruitLbls As VBA.Collection
Private lbc As clsLabelCaption
Private Sub Form_Load()
Set colFruitLbls = New VBA.Collection
Dim ctl As Access.Control
For Each ctl In Me.Controls
'use the tag property to identify which labels
'should have the behaviour
If ctl.ControlType = acLabel And _
ctl.Tag = "true" Then
Set lbc = New clsLabelCaption
lbc.init ctl, "target"
colFruitLbls.Ad d lbc
End If
Next
Set lbc = Nothing
End Sub
Private Sub Form_Unload(Can cel As Integer)
Set colFruitLbls = Nothing
</calling form code>
<target form code>
Option Compare Database
Option Explicit
Private Sub Form_Load()
Dim s As String
s = Me.OpenArgs & ""
Me.Text0.Value = s
End Sub
</target form code>
Thank you, rkc, it works, thank you very much.
Paul
"rkc" <rk*@yabba.dabb a.do.rochester. rr.bomb> дÈëÏûÏ¢ÐÂÎÅ
:Ut************ ********@twiste r.nyroc.rr.com. .. "Paul T. Rong" <et***@hotmail. com> wrote in message news:Tc******** *************@n ews.chello.at.. . Thank you, fred
but I would like to some other way. because there are 50 labels (and the number is subject to change according to the user), I can not to make it manually in your way 50 times or even more.
Is it possible to by vba
1. to select all labels 2. to write in their "double click" property something like
"=labelclic k" 3. to add something like:
Private Function labelclick() dim labelcap as string
My favorite way to add function to multiple controls of the same type is through a class using WithEvents.
<clsLabelCaptio n> Option Compare Database Option Explicit
Private WithEvents m_label As Access.Label Private m_targetForm As String
Public Sub init(lbl As Access.Label, formName As String) m_targetForm = formName Set m_label = lbl m_label.OnDblCl ick = "[Event Procedure]" End Sub
Private Sub m_label_DblClic k(Cancel As Integer) DoCmd.OpenForm m_targetForm, acNormal, , , , , m_label.Caption End Sub </clsLabelCaption >
<calling form code> Option Compare Database Option Explicit
Dim colFruitLbls As VBA.Collection Private lbc As clsLabelCaption
Private Sub Form_Load() Set colFruitLbls = New VBA.Collection Dim ctl As Access.Control
For Each ctl In Me.Controls 'use the tag property to identify which labels 'should have the behaviour If ctl.ControlType = acLabel And _ ctl.Tag = "true" Then Set lbc = New clsLabelCaption lbc.init ctl, "target" colFruitLbls.Ad d lbc End If Next
Set lbc = Nothing
End Sub
Private Sub Form_Unload(Can cel As Integer) Set colFruitLbls = Nothing </calling form code>
<target form code> Option Compare Database Option Explicit
Private Sub Form_Load() Dim s As String s = Me.OpenArgs & ""
Me.Text0.Value = s End Sub
</target form code> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: WindAndWaves |
last post by:
Hi Gurus
I have a very simple question this time.
I have a continuous form with a textbox (ID number) and a label. The label
has a on_click event: msgbox me.id.value
If I click on the label then I get a message : 1
Now, Imagine I have the cursor on ID = 1 (the first record), then I scroll
|
by: Armando |
last post by:
Hey gurus -
Access 2000 - I have a form with a series of box controls forming a map of
clickable areas, and I want each one to have a label. No problem, just put
'em on, right? But I also want the box/label combination to act as a single
item when clicked - that is, not have to put the same OnClick code on both
the box and the label (or force the user to click on the background only).
I've tried attaching the label to the box (by...
|
by: Rab |
last post by:
hi
i need to programmatically change the caption of a label that is linked
to another control (i.e. textbox, combobox). it's for a generic
function where i only know the textbox/combobox name but not the name
of the label that is linked to the textbox/combobox.
example sub:
public sub ReSetCaption()
|
by: Tom |
last post by:
Hi,
I have this question below but still cannot fix it.
http://communities.microsoft.com/newsgroups/previewFrame.as
p?
ICP=msdn&sLCID=us&sgroupURL=microsoft.public.dotnet.framewo
rk.aspnet&sMessageID=%253C01e601c3bef5%25240e272fe0%
2524a001280a@phx.gbl%253E
|
by: Venki |
last post by:
I have a textbox to enter an email address followed by a telephone textbox.
The email has a regularexpressionvalidator and a requiredfieldvalidator. The
ReqField works fine, but if I put in an invalid email addy then click in the
telephone field below, something very odd happens.
The telephone label & textbox (and all controls below) shift down one line,
and rather than having my cursor in the telephone textbox. The cursor is in
the...
| |
by: tshad |
last post by:
Is there another way to put labels on a page other than asp:label?
I have been building a page where I use a label to display the calculated
result of some imput. I do it using Javascript. But since the asp:label
equates to a <span> I have to create nodes to display the new text. The
problem is that as soon as I change pages (whether by post or just using a
back button), I lose whatever changes I made.
I don't have that problem with...
|
by: andrew.ames |
last post by:
Hi
I have a pretty basic windows application created in Visual Studio
2005 and VB.NET.
I set my Form's font to Arial 8.25pt, so when i added a label and a
button they automatically have a font of Arial and 8.25pt.
Great.
|
by: shapper |
last post by:
Hello,
I am styling the labels on a section of my page as follows:
label {float: left; width: 6.5em;}
Now I want to remove this styling from a label that has the class
"Message".
Mu questions are:
|
by: Mr. X. |
last post by:
Hello.
In Visual Studio 2008,
there is on the toolbox -login -login,
which create a login form.
On that form there is a LoginButton, which click on it is evented on the
"default.aspx.vb" codeBehind.
How can I use the value on the codeBehind (default.aspx.vb) of UserName &
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |