Solved

change label caption in MS Access

Posted on 2010-11-08
6
741 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

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…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

895 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