Solved

change label caption in MS Access

Posted on 2010-11-08
6
728 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 - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) 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 142

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now