New Db building stuff

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

Re: New Db building stuff

Post by bknight »

I decided to alter the table to include a field Notes, which requires an alteration of both the query(done) and the form. I include a small image of the addition. Now in previous versions there was a "group" setting to design a structure. I can mimic the height and top of multiple selections, not much unlike the old groupings, but easy design ends there for me. Notice the box seems to be surrounding image of the text box by a blue outline.
How may I add the blue line to my new text box?
Secondly, I select that the form view, but when opened defaults to that view, is there a setting to prohibit that view?
You do not have the required permissions to view the files attached to this post.

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

Re: New Db building stuff

Post by HansV »

Can you select the blue rectangle and drag its right edge?

I don't understand the sentence "Secondly, I select that the form view, but when opened defaults to that view, is there a setting to prohibit that view?". Please keep in mind that English is not my first language.
Best wishes,
Hans

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

Re: New Db building stuff

Post by bknight »

The form opens in form view and I want datasheet view only.
You do better with multi languages whereas I converse only one poorly.

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

Re: New Db building stuff

Post by HansV »

Set the properties of the Form in the Format tab of the Property Sheet like this:
S2143.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

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

Re: New Db building stuff

Post by bknight »

The form opens in form view and I want datasheet view only.
You do better with multi languages whereas I converse only one poorly.

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

Re: New Db building stuff

Post by HansV »

:confused:
Best wishes,
Hans

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

Re: New Db building stuff

Post by bknight »

I decided to alter the table to include a field Notes, which requires an alteration of both the query(done) and the form. I include a small image of the addition. Now in previous versions there was a "group" setting to design a structure. I can mimic the height and top of multiple selections, not much unlike the old groupings, but easy design ends there for me. Notice the box seems to be surrounding image of the text box by a blue outline.
How may I add the blue line to my new text box? See image two posts ago.

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

Re: New Db building stuff

Post by HansV »

Can you select the blue rectangle and drag its right edge?

(there seems to be an echo in here)
Best wishes,
Hans

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

Re: New Db building stuff

Post by bknight »

This what happened moving all but the last text box down and then vertically selecting the OrderNum text box and the shadow around it. Only the text box is selected, and I unable to select the blue outline. Even the upper left hand corner.
You do not have the required permissions to view the files attached to this post.

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

Re: New Db building stuff

Post by HansV »

I'm sorry, I don't know - I never use this design feature.
Best wishes,
Hans

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

Re: New Db building stuff

Post by bknight »

It was a built in feature with the create>>Forms. Its ok I'll just forgo it, the outline doesn't show up in the datasheet view.

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

Re: New Db building stuff

Post by bknight »

When wake in the morning.

Code: Select all

Private Sub Price_Form_BeforeUpdate(Cancel As Integer)
    Dim dblPrice As Double
    If IsNull(dblPrice) Then
        Convert2Num = Null
    Else
        dblPrice = Split(Price, "'")
        If UBound(dblPrice) = 0 Then
            Convert2Num = CDbl(dblPrice(0))
        Else
            Convert2Num = dblPrice(0) + dblPrice(1) / 32
        End If
    End If
End Sub
On entering 114'24.5 (example)
I got the following error message, that's true that's why we discussed conversion earlier in the thread. What changes are necessary?

To add more insults to me design, I received a different error message when entering a Commission.

Code: Select all

Private Sub Commission_BeforeUpdate(Cancel As Integer)
    If Me.[Symbol] = "MES" Then
        If Me.[ActionID] = 46 Or Me.[ActionID] = 48 Then
            Me.[Commission] = -Me.Quantity * 0.5
            Me.[Commission] = Me.Quantity * 0.5
        End If
    ElseIf Me.[Symbol] = "TY" Then
        If Me.[ActionID] = 46 Or Me.[ActionID] = 48 Then
            Me.[Commission] = -Me.[Quantity] * 1.5
            Me.[Commission] = Me.[Quantity] * 1.5
        End If
    ElseIf Me.[Symbol] = "US" Then
        If Me.[ActionID] = 46 Or Me.[ActionID] = 48 Then
            Me.[Commission] = -Me.[Quantity] * 1.5
            Me.[Commission] = Me.[Quantity] * 1.5
        End If
    End If
End Sub
The code is intended to ensure the correct commission is entered and that it is a negative number. What needs to change on this one, Fees will have the same form logic. I entered a positive 1 it should be -1.5 and the code stopped at the highlighted part and I believe indicated property not found.
Th images are upside down referencing the discussion.
ETA: I thought maybe the -me was the issue so I changed the line to Me.[Quantity]*1.5*-1, and recieved an identical error.
You do not have the required permissions to view the files attached to this post.

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

Re: New Db building stuff

Post by HansV »

1) Price_Form_BeforeUpdate makes no sense.
Please copy the Convert2Num function into a general module (the kind you create by selecting Insert > Module).
Then create an After Update event procedure for the Price text box.

Code: Select all

Private Sub Price_AfterUpdate()
    Me.Price = Convert2Num(Me.Price)
End Sub
2) What is the data type and field size of the Commission field?
And is the text box bound to the Commission field on the form named Commission? Or something else?
Best wishes,
Hans

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

Re: New Db building stuff

Post by bknight »

2)Currency 2 decimals. The field is named commission on all objects.

1) makes no sense to me why have a separate bit of code to calculate a number and then set that value to the fields value. I haven't tried yet but it seems as though the code snippet you send is lacking in a Dim declaration and then a method to call it,

ETA:

Code: Select all

Function Convert2Num(Price As Variant)
    Dim arr() As String
    If IsNull(Price) Then
        Convert2Num = Null
    Else
        arr = Split(Price, "'")
        If UBound(arr) = 0 Then
            Convert2Num = CDbl(arr(0))
        Else
            Convert2Num = arr(0) + arr(1) / 32
        End If
    End If
End Function
I didn't check it as you requested yesterday but on entering 114'24.5 results in the value of 114.
You do not have the required permissions to view the files attached to this post.

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

Re: New Db building stuff

Post by HansV »

The code that I posted is an event procedure. It will be executed automatically after the Price text box has been updated.
See this reply in one of your other threads.
Best wishes,
Hans

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

Re: New Db building stuff

Post by bknight »

Code: Select all

Function Convert2Num(Price As Variant)
    Dim arr() As String
    If IsNull(Price) Then
        Convert2Num = Null
    Else
        arr = Split(Price, "'")
        If UBound(arr) = 0 Then
            Convert2Num = CDbl(arr(0))
        Else
            Convert2Num = arr(0) + arr(1) / 32
        End If
    End If
End Function
On entering 114'24.5 results in the value of 114.
Then the corrected code will go into.

Code: Select all

Private Sub Price_AfterUpdate()

End Sub
You do not have the required permissions to view the files attached to this post.

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

Re: New Db building stuff

Post by HansV »

Try entering

Code: Select all

? Convert2Num("114'24.5")
in the Immediate window.
Best wishes,
Hans

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

Re: New Db building stuff

Post by bknight »

Adding parentheses around still results in 114, which begs the question would one be required to add parentheses or is Access able to read 114'24.5 as a string?
You do not have the required permissions to view the files attached to this post.

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

Re: New Db building stuff

Post by HansV »

Please take a second to read my previous reply again.
Best wishes,
Hans

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

Re: New Db building stuff

Post by bknight »

Ok yes Convert2Num("114'24.5") results in 114.765625. Now to return to the code you posted which I will have in

Code: Select all

Private Sub Price_AfterUpdate()
Function Convert2Num(Price As Variant)
    Dim arr() As String
    If IsNull(Price) Then
        Convert2Num = Null
    Else
        arr = Split(Price, "'")
        If UBound(arr) = 0 Then
            Convert2Num = CDbl(arr(0))
        Else
            Convert2Num = arr(0) + arr(1) / 32
        End If
    End If
    Me.[Price] = Convert2Num()
End Function
End Sub
1) Is this correct?
2) Will the entered value require parentheses, or does Access recognize that 124'24.5 is a string?