Message box question

CEH

Curtis
Local time
Today, 15:59
Joined
Oct 22, 2004
Messages
1,187
I have a form with a dropdown field. On this field I have a message box to warn that you are about to change (in this case) "ClientID"
My question is how can I reference the current field name and the name the field is about to be changed to?
ie... "You are about to change "ClientID current" to "ClientID New"....... Do you want to proceed?".... "YES" "NO"
 
CEH said:
I have a form with a dropdown field. On this field I have a message box to warn that you are about to change (in this case) "ClientID"
My question is how can I reference the current field name and the name the field is about to be changed to?
ie... "You are about to change "ClientID current" to "ClientID New"....... Do you want to proceed?".... "YES" "NO"

Hey CEH,

I'm not positive on this but I think this is something like what your looking for. I'm assuming you mean just the message part itself and not the whole MsgBox.

"You are about to change ClientID from: " & Me.ClientID.OldValue & " to: " & Me.ClientID.Value & " Do you want to proceed?"

HTH,
Shane
 
Thanks Shaneman! Thats working...... almost :)
I didn't know about the ".oldvalue"
One last problem.... Its a combo box...... "cboClientID" It IS returning the value..... Just not the one I want displayed! I want it to be something like.....
"Me.cboClientID.column(1).oldvalue" But this syntax doesn't work.... I've tried many ways but can't seem to hit on the right one! It's pulling column(0) in when I want it to display column(1)

Thanks again
Curtis
 
Please check you syntax and capital letters

OldValue not oldvalue

Hope this helps.
 
CEH said:
Thanks Shaneman! Thats working...... almost :)
I didn't know about the ".oldvalue"
One last problem.... Its a combo box...... "cboClientID" It IS returning the value..... Just not the one I want displayed! I want it to be something like.....
"Me.cboClientID.column(1).oldvalue" But this syntax doesn't work.... I've tried many ways but can't seem to hit on the right one! It's pulling column(0) in when I want it to display column(1)

Thanks again
Curtis

Hey Curtis,

Someone else can step in if they know of a different work around but what I would do if I was in your shoes is to put an unbound text box on my form and have the value of the unbound text box equal the value of the column I need from the cboBox before it changes and then reference the unbound text box in my message box. The reason is because obviously if your not going to be able to reference the OldValue in any other column but the first one, then you'll have to work around it.
I'm not positive if your able to reference OldValue any of the other columns.

HTH,
Shane
 
Last edited:
Problem solved......

Got it to work...... Heres how...... IF anyone knows a better way please let me know....
Thanks

First declare global

Option Compare Database
Dim strHoldValue As String



Then we record the current record displayed in the combo box

Private Sub Form_Current()
strHoldValue = Me.cboClientID.Column(1)
End Sub



Then when we alter the record…….



Private Sub cboClientID_BeforeUpdate(Cancel As Integer)
Dim Msg, Style, Title, Response, MyString

If Not Me.NewRecord Then
Msg = "You are about to change the Client ID from: " & strHoldValue & " to: " & Me.cboClientID.Column(1) & " " & Chr(13) & "Do you want to continue ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "WARNING"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
MyString = "Yes"
ElseIf Response = vbNo Then
MyString = "No"
Cancel = True
Undo
Else
End If
End If

End Sub

Now the message box displays the name column(1) and not column (0)
 

Users who are viewing this thread

Back
Top Bottom