?
Solved

change label caption in MS Access

Posted on 2010-11-08
6
Medium Priority
?
757 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 500 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 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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.
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…
Suggested Courses
Course of the Month10 days, 6 hours left to enroll

765 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