Puzzling query out pt

bknight
BronzeLounger
Posts: 1389
Joined: 08 Jul 2016, 18:53

Re: Puzzling query out pt

Post by bknight »

Feeds the Convert2Num. It is separate from frmTrades. Paste the correct string into RawPrice and press enter, Price is calculated.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Puzzling query out pt

Post by HansV »

Why not paste the string directly into the relevant Raw Price text box of frmTrades, and have its After Update event procedure update the Price text box on frmTrades?
Best wishes,
Hans

bknight
BronzeLounger
Posts: 1389
Joined: 08 Jul 2016, 18:53

Re: Puzzling query out pt

Post by bknight »

That is precisely what I do, I'm trying to eliminate one copy and two pastes.

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Puzzling query out pt

Post by HansV »

Assuming that the names of the relevant text boxes are RawP and Price, use the original version of the function, and the following After Update event procedure of RawP:

Code: Select all

Private Sub RawP_AfterUpdate()
    Me.Price = Convert2Num(Me.RawP)
End Sub
Best wishes,
Hans

bknight
BronzeLounger
Posts: 1389
Joined: 08 Jul 2016, 18:53

Re: Puzzling query out pt

Post by bknight »

Nothing works now and I'm not indicating it is anything you have suggested, but the changes I have made. Firstly I'm assuming that it was your idea to paste the string number (114'24.0) into RawP where it should be placed.
RawPrice is a field in frmFracCalculator, no change in that. After changing the RawP_AfterUpdate, I receive an error Ambiguous name detected: Convert2Num sub/function. Now there is only one named Convert2Num so I'm not sure where the ambiguity exists, but nothing works and I stumped. I will attempt to recreate everything from a Db prior to all the changes.

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Puzzling query out pt

Post by SpeakEasy »

> but it did, until it didn't.

And I remain surprised at this result, as I said earlier; my reason: same as Hans': the built-in year function does not return a two digit number, never has.

But that suggests an alternative. Are you sure that the code you are using does not have (or had) a user defined Year function? That would take priority over the built-in function.
Last edited by SpeakEasy on 03 Jun 2023, 23:25, edited 1 time in total.

bknight
BronzeLounger
Posts: 1389
Joined: 08 Jul 2016, 18:53

Re: Puzzling query out pt

Post by bknight »

Well I found a previous version and rebuilt the codes and everything works as I wanted reducing one copy and two pastes.

Code: Select all

Private Sub RawPrice_AfterUpdate()
    Me.Price = Convert2Num(Me.RawPrice)
    Forms!frmtrades.RawP = Me.RawPrice
    Forms!frmtrades.Price = Me.Price
    Forms!frmtrades.Commission.SetFocus
    Forms!frmtrades.SetFocus
End Sub

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Puzzling query out pt

Post by HansV »

That still uses frmFracCalculater (or frmFracCalculation or frmracCalculaor), but that shouldn't be necessary.
Best wishes,
Hans

bknight
BronzeLounger
Posts: 1389
Joined: 08 Jul 2016, 18:53

Re: Puzzling query out pt

Post by bknight »

That contains the RawPrice and the Caolculated value of the string number. You know we tried many attempts at making the Convert2Num work, it works, but putting it into a field was the error, That's when I came up with the fraction calculator form to utilize the function and have a number to add to the number field.