Rabu, 11 Januari 2017

Re: [MS_AccessPros] Not getting correct "Rate" values

 

Khalid-


=cmbProductID.Column(1) is invalid as a Control Source.  It must be the name of a field in the underlying Record Source if you want to update something.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jan 11, 2017, at 4:26 PM, khalidtanweerburrah@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



John,

OMG! I have been trying on it for the last 2 days, but did not get in mind to change it to
Double. Anyways thank you very much it is now giving correct values.

Now coming to another issue.

Presently i am entering "DestinationRate" on a form "Add New Destination Freight Rates" on the
main form there is Unbound Combo box "Destination" asking user to select Destination. Its Row Source
is:
SELECT Destination.Destination
FROM Destination
ORDER BY Destination.Destination;

On the subform "Add New Destination Freight Rates Subform" selecting from Combo box "cmbProductID"
"ProductID" having Row Source:
SELECT Products.ProductID, Products.ProductNameEnglish
FROM Products
ORDER BY Products.ProductID;
Then displaying "ProductNameEnglish" on the Text box "cmbProductNameEnglish" having Control Source
=[cmbProductID].[Column](1) and then entering "DestinationRate" on Text box "DestinationRate".

In this design we have to feed seperately for each Destination for all ProductID.

What i need and the boss is demanding is that on a single screen the form should display all Products (ProductID with ProductNameEnglish)
and all Destinations something like Crosstab report.Like:

Product ID Destination1    Destination2  and so on...
1 DestinationRate DestinationRate DestinationRate
2 DestinationRate DestinationRate DestinationRate
3
.
.
.
At present there are more than 100 Products and about 10 Destinations.

Could this type of form be designed ?
Please help.

Regards,
Khalid


---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Khalid-

If Rate contains a fraction, you need to declare varRate As Double or Single.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jan 11, 2017, at 10:40 AM, Khalid Tanweer khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Hi John,

Hope you will be fine with good health.

I have to make some changes in PCTL database due to the demand of my previous boss, he is now himself using this database having PCTL_be.accdb & PCTL.accde on his Laptop. On his request i sometimes make changes and additions as per his requirements due to current demands and requirements of his business.

Now his demand was to insert/add an ID in form "CollectionVoucher" for field "ProductNameEnglish"

Before in table "Products" field "ProductNameEnglish" was PK, now i added field "ProductID" and is PK now. (Number-->Long Integer-->Decimal Places 0). I deleted all relationships for "ProductNameEnglish" and replaced with "ProductID". Up to now my workings on changes are OK. I was stucked at some points but tried to resolve them by myself, instead of bothering you on those.

But now i am stucked in form "CollectionVouchersubform" data entry at one point. (Link Master/Child field is ConsignmentNo"). At field "Rate" On Got Focus event it is NOW not giving correct value. The event is:

Private Sub Rate_GotFocus()
    If IsNull(WeightOfCarton) Then
        MsgBox "Oops you forget to enter Weight Of Carton." & vbCrLf & _
        "Please enter Gross Weight." _
        , vbExclamation, "PCTL - Missing Entry"
        WeightOfCarton.SetFocus
    End If

    Dim varRate As Integer <==== Before it was Varient

    varRate = DLookup("DestinationRate", "tblDestinationRates", _
        "Destination = '" & Me.cmbDestination & _
        "' AND ProductID = " & Me.ProductID & "") <==== Before it was "ProductNameEnglish"
    Me.Rate = Nz(varRate, 0)
End Sub

Now value for "Rate" is displaying 3.00 for any "ProductID" though they are different for each "Destination" ---> ProductID" in "tblDestinationRates". There is no Default Value set for field "Rate".

Could you please figure it out and help.

Regards,
Khalid








__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar