Solved

change label caption in MS Access

Posted on 2010-11-08
6
753 Views
Last Modified: 2012-05-10
I currently have frm_main & frm_incoming

frm_main got 2 buttons:   1. incoming, and 2. outgoing

onClick of incoming, in_or_out (unbound label) =       Me.in_or_out = "incoming"
onClick of outgoing, in_or_out (unbound label) =       Me.in_or_out = "outgoing"

------------------------------------------------------
The problem:
-------------------
on open of frm_incoming:

Private Sub Form_Open(Cancel As Integer)
    If Forms!frm_main!in_or_out = "outgoing" Then
    Me.Label129.Caption = "123"
    End If
End Sub

This code works, but only on the 2nd click of "outgoing" button

Is there a way to get it right from the 1st click?

Thanks
0
Comment
Question by:omanca
6 Comments
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 125 total points
ID: 34090492
Maybe try the Form Load event:


Private Sub Form_Load()
    If Forms!frm_main!in_or_out = "outgoing" Then
    Me.Label129.Caption = "123"
    End If
End Sub
0
 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 125 total points
ID: 34090526
If in_or_out is a label, try this code in the current event.

Private Sub Form_Current()
    If Forms!frm_main!in_or_out.Caption = "outgoing" Then
    Me.Label129.Caption = "123"
    End If
End Sub

Sincerely,
Ed
0
 
LVL 2

Author Comment

by:omanca
ID: 34091233
Seems like I had to close the app and re-open it.

It works just fine !!



Thanks guys.
0
 
LVL 2

Author Comment

by:omanca
ID: 34935716
Hi again angellll,

I managed to resolve this.  Please read my comment:

11/09/10 01:15 AM, ID: 34091233


Thanks and regards.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 34941480
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question