I am recieving 424 - Object Required error. What to do?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ibrahim Nohbala
    New Member
    • Dec 2010
    • 4

    #1

    I am recieving 424 - Object Required error. What to do?

    Hello.
    I've written a small program in MS Access 2007 that calculates how many goods left in stock in 3 different units. For example, I have a product that has 3 units of measurement: gr,kg and Piece (P). There are 1000gr in 1kg and 3.5kg in 1P. I'm collecting amounts in minimal units in this example in grams. I want the program to show me the result in all 3 units as there are 4770gr left in my stock. I have a query "mal_hereketi_t am" that calculates how many left in minimal unit. And I tried to write a function code in a module to be able to use in all my reports. I will provide the field names of the query as function's arguments, but the code raises "424 - Object required" error as a result. But it must show 1P1kg270gr. The experimentary piece of my module function is:
    Code:
    Public Function gir_data(Miqdar, u1, u2 As Double, ed1, ed2, ed3 As String, R1 As Integer) As String
    On Error GoTo sehv
    Dim AAA, BBB, CCC As Double
    Dim Baza As Database
    
    Set Baza = CurrentDb
    AAA = Fix(Abs(Miqdar) / u1 / u2)
    BBB = ((Abs(Miqdar) / u1 / u2) - AAA)
    CCC = BBB * u1 * u2
    
    If (Miqdar Is Null Or Miqdar = 0) Then
        gir_data = Null
        Exit Function
    ElseIf (Miqdar < 0 And R1 = 1) Then
        gir_data = "-" & Abs(Miqdar) & ed1
        Exit Function
    ElseIf (Miqdar < 0 And R1 = 3) Then
        gir_data = "-" & AAA & ed3
        Exit Function
    ElseIf (Miqdar > 0 And R1 = 3) Then
        gir_data = AAA & ed3
        Exit Function
    End If
    
    Cixis:
        Exit Function
    
    sehv:
        'gir_data = Err.Number & " - " & Err.Description
        gir_data = Round(AAA, 3) & ed3
        Resume Cixis
    
    End Function
Working...