Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8491477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:26:10+00:00 2026-06-10T22:26:10+00:00

What i want is to retrieve quantity in database from piece and covert it

  • 0

What i want is to retrieve quantity in database from piece and covert it to dozen. Then input as dozen and convert back to pieces and save to database again.

when I input data eg. 10.3, it should convert to 123 piece for me ((10 * 12) + 3). My code work well without my “If clause” but only when data was “single” type. It made error when I input integer number, so I added “If..” statement to check it first which is now the output was correct for Integer but incorrect when I input single number.

I have this code..

Function DzToPcs(val)

'If CLng(val) = val then <-- not work
'if Fix(val) <> val then <-- work but the output was not correct when input single type number.
if Int(vInt) = vInt then <-- work but the output was not correct when input single type number.
    DztoPcs = val * 12
else
    strInt =  Cstr(val)
    a = Split(strInt,".")

    dz = a(0) 
    pcs = a(1)

    getdz = Cint(dz)
    getpcs = Cint(pcs)

    DztoPcs = (getdz * 12) + getpcs
end if 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:26:12+00:00Added an answer on June 10, 2026 at 10:26 pm

    I’m not sure what’s wrong with your if statements (my VBScript is a little rusty), but you could try this alternative:

    Function DzToPcs(val)
    
        strInt =  Cstr(val)
        a = Split(strInt,".")
        dz = a(0) 
    
        if UBound(a) > 0 then
            pcs = a(1)
            getdz = Cint(dz)
            getpcs = Cint(pcs)
            DztoPcs = (getdz * 12) + getpcs
        else
            DztoPcs = dz * 12
        end if 
    
    end function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to retrieve year and then month from this kind of date: 2011-12-23
I want to retrieve the value converted to array and then to object.. $input
I want to retrieve a row from a MySQL database which returns a row,
I want to retrieve data from the database. The number of data is fixed
I have a HTML table as follows. I want retrieve row values from this
I want to retrieve website title from webview cookies of my application. I am
I want to retrieve events from my google calendar on my phone. Is there
I want to retrieve the JSON from http://www.bartdekimpe.be/anoire/index.php/admin/getGamesUserJson/34 but I can't seem to get
I want to retrieve information from SAP to Ruby on Rails. I found this
I want to retrieve Softwares installed from remote host. I want to get details

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.