On Current Event Problem

ViRi

Registered User.
Local time
Yesterday, 16:14
Joined
Jan 31, 2006
Messages
44
Hi

I have a form frmCurrency with two buttons one called GBP and the other EURO.

On clicking any of the two buttons a second form frmInvoice opens on a new record and a check box called Euro therein is set.

The purpose of ths is only to set the sign ie € or £ not convert the value.

Code:
'GBP button On Click
Dim stDocName As String
 
    Dim stLinkCriteria As String

    stDocName = "frmInvoice"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.GoToRecord , , acNewRec
    Forms!frmInvoice!Euro = False
    RunCommand acCmdSaveRecord

or

Code:
'EURO button On Click
Dim stDocName As String
 
    Dim stLinkCriteria As String

    stDocName = "frmInvoice"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.GoToRecord , , acNewRec
    Forms!frmInvoice!Euro = True
    RunCommand acCmdSaveRecord

Then I have placed the following code on the On Current Event of the opened Form ie frmInvoice.

Code:
Dim E As TextBox
Set E = Forms!frmInvoice!Text65

Euro.SetFocus

If Me.Euro = True Then
E.Format = "€0.00"
Else
E.Format = "£0.00"
End If

It works but it sets all the records. I only require the new record created to be set the other existing record values will not change.

ViRi
 
vi,

Couple of problems here.

If you want a command button to set the number's format, the button
just has to have something like --> Me.txtYourNumber.Format = "Euro"
Or, set it to "Currency". That will change the displayed prefix.

But you appear to have a continuous form and your button is setting
the format for ALL records.

That is how continuous forms work. If there is nothing to differentiate
the value of a field, they will all be displayed the same.

You can save the checkbox type (option group would be better). Then
Access's continuous forms can use the saved value to "Conditionally Format"
the displayed number. BUT, you can really only change the visibility,
font, colors. I don't think that you can change it's display format.

Anyway, need more info.

Wayne
 
Hi Wayne

I think I've solved the problem.

I had just dropped a check box on the form so it's wasn't stored. It was not a field in the source table.

I have included the Euro check box in the Table Invoice as a field and it works perfectly once the form is refreshed.

I have have to remove the line that saves the record though.

ViRi
 

Users who are viewing this thread

Back
Top Bottom