Page 2 of 3 FirstFirst 123 LastLast
Results 41 to 80 of 97

Thread: code error 09 in vb 6 accounting system

  1. #41
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    The method I'd use would be to store the Cost Price in Dollars in the Table, together with the %age Net Profit I want to make on each sale. At the start of the day, input the exchange rate and then calculate today's Selling Price

    Selling Price [Euro] = Cost Price[Dollars] * (1 + (%age Profit / 100) * Todays Exchange Rate.

    Thus if I purchased a Pen for 1 USD and wanted to make 120% Net Profit and the Euro Exchange rate was 1$ = 0.75 Euro

    Selling Price = 1 * (1 + 1.2) * 0.75 Euro = 1.65 Euro

    If the exchange rate changes to 1$ = 0.72 Euro the selling price would be 1.58 Euro etc.

    If you're just holding the Selling Price (in Euro) in the Table, then you'll have to express the current exchange rate as a %age of the original rate (i.e the rate you used to calculate the selling price in the first place)

    Thus if you're selling at 1.58 Euro, based on an exchange rate of 1$ = 0.72 Euro and the exchange rate changes to 1$ = 0.75 Euro (i.e. % difference of (0.75 - 0.72) / 0.72 = 4.166% ) you now sell at 1.58 + (1.58 * 4.166/100) = 1.65 Euro. Thus you need to store the Selling Price and the exchange rate it's based on in the Table.

    ie.
    Percentage Change = (Yesterday's exchange rate - Today's exchange rate) * 100 / Yesterday's exchange rate
    Today's Selling Price= Yesterday's Selling Price * (1 + (Percentage Change / 100))

    EDIT: It would be a 'strange' Retail Store where the Selling Prices for products changed on a daily basis - your Customers would never know how much a Pen was going to cost them. I'd be surprised if I bought a Pen from you yesterday at 1.58 Euro, today it cost me 1.65 Euro and perhaps the next day only 1.50 Euro. I expect fluctuations but not on a dialy basis. It would be a nightmare for the sales staff to go round every day changing the price tags for everything !
    Last edited by Doogle; Jun 21st, 2013 at 01:15 AM.

  2. #42
    Member
    Join Date
    Nov 2012
    Posts
    62

    Re: code error 09 in vb 6 accounting system

    The traditional way of accounting across multiple currency environments is to store ALL your values in a home currency (presumably Euros in this case).

    So when you are entering stock, you should put in how many dollars you paid and what the exchange rate was at that time, then store the result in Euros.

    This way you can easily calculate actual Profit/Loss reports by comparing your purchase Costs in Euros with the Sale costs in Euros.
    If you store them in different currencys, and you do not store the exchange rate at the time of transaction then producing the same report on different days with different current exchange rates will give you different answers.

  3. #43

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    hello Mr.Doogle ... it's a great idea to make a new table / column that saves the prices .
    you do always surprise me with awesome ideas ... but you know now that i can't do that without ur help ..
    can you please guide me to do this in code or to make this possible inside the program ?

    thank you

  4. #44

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    THE Welshman thank you for the replay , but i will go with Mr.Doogle idea it's better and completing the program, also it's more close to the market and to the users of this programs.

  5. #45

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    Name:  doogle1.jpg
Views: 1601
Size:  101.4 KBName:  doogle2.jpg
Views: 1628
Size:  254.4 KB

    Mr. Doogle ... those are the errors i get for the code u made me to edit all the prices.. for some reason i get this error

  6. #46
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    In the SELECT statement you have to substitute your table's Name for 'Table' and the Column name that holds the Price for 'Price'

  7. #47

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    Quote Originally Posted by Doogle View Post
    In the SELECT statement you have to substitute your table's Name for 'Table' and the Column name that holds the Price for 'Price'

    I did changed the price with the qmimi_sh.... The qmimi is the culomn that holds the price in the db

  8. #48
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    Look at your code again, in Post #45, unless my eyes deceive me there's a line there:
    Code:
    strSQL = "SELECT Price FROM Table"
    Hint, it's immediately before the one in yellow.

  9. #49

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    Quote Originally Posted by Doogle View Post
    Look at your code again, in Post #45, unless my eyes deceive me there's a line there:
    Code:
    strSQL = "SELECT Price FROM Table"
    Hint, it's immediately before the one in yellow.
    Yes sir i got it
    Anyway i want the idea u told me about. , like making a new table with changable prices its breliant one

  10. #50

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    Still getting the same error...

    this is the things i have changed as you told me

    Name:  Doogle3.jpg
Views: 1476
Size:  281.1 KB

  11. #51
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    Take a deep breath, have a cup of coffee and re-read the advice you've been given.

    It was never suggested you change the SQL to "tblArtikujt", it was never suggested you use
    Code:
    rs.Open db,adOpenStatic, adLockOptimistic

  12. #52

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    i am sorry sir but i can't fix it it's harder than i thought ..
    can you please show me how ?

  13. #53
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    How hard can it be to change
    Code:
    strSQL = "SELECT Price FROM Table"
    to
    Code:
    strSQL = SELECT qmimi_shitj FROM tblArtikujt"
    ????

  14. #54

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    still getting the same error
    Last edited by nawar; Jun 22nd, 2013 at 04:44 PM.

  15. #55

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    here is the error :

    Name:  doogle4.jpg
Views: 1592
Size:  33.3 KBName:  doogle5.jpg
Views: 1572
Size:  111.0 KB

  16. #56
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: code error 09 in vb 6 accounting system

    Quote Originally Posted by Doogle View Post
    How hard can it be to change
    Code:
    strSQL = "SELECT Price FROM Table"
    to
    Code:
    strSQL = SELECT qmimi_shitj FROM tblArtikujt"
    ????
    Doogle

    Perhaps you meant this instead

    Code:
    strSQL = SELECT qmimi_shitjes FROM tblArtikujt"
    Spoo

  17. #57

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    still the same ... Error .

  18. #58
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: code error 09 in vb 6 accounting system

    Nawar

    Did you also change these ...

    Code:
    Do Until rs.EOF
        rs![qmimi_shitjes] = rs![qmimi_shitjes] + (curDelta * rs![qmimi_shitjes] / 100)
        rs.Update
        rs.MoveNext
    Loop
    EDIT

    BTW, did you ever define db?

    Code:
    Set rs = New ADODB.Recordset
    strSQL = "SELECT qmimi_shitjes FROM tbdArtikujt"
    rs.Open db, adOpenStatic, adLockOptimistic

    EDIT 2

    I'm a DAO kinda guy (as opposed to ADO), so my knowledge
    of the syntax is minimal. Nonetheless, I found this in MSDN

    Code:
    Dim cnn1 As ADODB.Connection
    Dim rstEmployees As ADODB.Recordset
    Dim strCnn As String
    Dim varDate As Variant
    
    ' Open connection.
    strCnn = "Provider=sqloledb;" & _
    "Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
    Set cnn1 = New ADODB.Connection
    cnn1.Open strCnn
    
    ' Open employee table.
    Set rstEmployees = New ADODB.Recordset
    rstEmployees.CursorType = adOpenKeyset
    rstEmployees.LockType = adLockOptimistic
    rstEmployees.Open "employee", cnn1, , , adCmdTable
    Perhaps you need to modify your code to follow the above
    example.

    Spoo
    Last edited by Spoo; Jun 22nd, 2013 at 06:55 PM.

  19. #59

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Exclamation Re: code error 09 in vb 6 accounting system

    Quote Originally Posted by Spoo View Post
    Nawar

    Did you also change these ...

    Code:
    Do Until rs.EOF
        rs![qmimi_shitjes] = rs![qmimi_shitjes] + (curDelta * rs![qmimi_shitjes] / 100)
        rs.Update
        rs.MoveNext
    Loop
    EDIT

    BTW, did you ever define db?

    Code:
    Set rs = New ADODB.Recordset
    strSQL = "SELECT qmimi_shitjes FROM tbdArtikujt"
    rs.Open db, adOpenStatic, adLockOptimistic

    EDIT 2

    I'm a DAO kinda guy (as opposed to ADO), so my knowledge
    of the syntax is minimal. Nonetheless, I found this in MSDN



    Perhaps you need to modify your code to follow the above
    example.

    Spoo
    Yes man i already changed these qmimi and also tried ti define the db it seens like there is something wrong in accessing the db i also tried to add the pass link and the db location but still the same error!!!

  20. #60
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    Code:
    strSQL = "SELECT qmimi_shitjes FROM tbdArtikujt"
    rs.Open strSQL, db, adOpenStatic, adLockOptimistic

  21. #61

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    Still the same Error:...

    Code:
    strSQL = "SELECT qmimi_shitjes FROM tbdArtikujt"
    rs.Open strSQL, db, adOpenStatic, adLockOptimistic
    and the qmimi_shitj also ...
    but nothing works

  22. #62
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    Quote Originally Posted by nawar View Post
    Still the same Error:...
    So, let's get this clear, you've changed the code so it now reads:
    Code:
    Set RS = New ADODB.RecordSet
    strSQL = "SELECT qmimi_shitjes FROM tbdArtikujt"
    RS.Open strSQL, db, adOpenStatic, adLockOptimistic
    and you're still getting "the same Error ", i.e. error '3001', on the 'RS.Open' statement ?
    Last edited by Doogle; Jun 23rd, 2013 at 10:35 AM.

  23. #63

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    yes sir i still getting an error .. but it's a different message and different number as in the picture below

    Name:  doogle6.jpg
Views: 1510
Size:  102.7 KBName:  doogle7.jpg
Views: 1470
Size:  172.1 KB

  24. #64

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    and also i have already tried qmimi_shitj not shitjes as u wrote !

  25. #65
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    The error message indicates that the connection to the Database is not active.Go back to Post #34 and read this bit again:
    where: 'Table' is the name of the table containing the Price, 'Price' is the column name representing the Price and 'db' is an open connection to the DataBase. Assumes that 'Price' is a Currency Type in the Table.
    So far we've managed to get the Table and the Column name correct all we need now is the Database Connection. I used 'db' as the Database connection, yours is 'strConek'. What do you think you should change ?

  26. #66

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    i have changed the db , but still getting error ...

    Name:  doogle8.jpg
Views: 1464
Size:  151.8 KBName:  doogle9.jpg
Views: 1451
Size:  100.2 KB

  27. #67
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    Reread Posts #34 and #65

  28. #68

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    Quote Originally Posted by Doogle View Post
    Reread Posts #34 and #65
    i am sorry but i still getting errors ... what ever i do ... i can show you million way i have already tried but with no success... if u can make it easier for me i will appreciate that...

    thank you

  29. #69

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    couldn't fix it ... nothing works

  30. #70
    Member
    Join Date
    Nov 2012
    Posts
    62

    Re: code error 09 in vb 6 accounting system

    Doogle's code in #25 shows opening a recordset that works.
    Try using that as a basis for what you are doing here.

  31. #71

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    Doogle .. i end up with this code .. can you please help me a little ..

    Code:
      
    Private Sub cmdChangePrice_Click()
    Call dbconek
    With ar
    Dim curDelta As Currency
    Dim rs As ADODB.Recordset
    If txtDeltaPrice.Text <> "" Then
        If IsNumeric(txtDeltaPrice.Text) Then
            curDelta = CCur(txtDeltaPrice.Text)
            Set rs = New ADODB.Recordset
            criteria = "Select *From tblArtikujt Where qmimi_shitjes='" & frmArtLista.txtDeltaPrice & "'"
            rs.Open criteria, strConek, adOpenStatic, adLockOptimistic
            If Not (rs.BOF And rs.EOF) Then
                Do Until rs.EOF
                    rs![qmimi_shitjes] = rs![qmimi_shitjes] + (curDelta * rs![qmimi_shitjes] / 100)
                    rs.Update
                    rs.MoveNext
                Loop
            End If
        Else
            MsgBox "Please enter a numeric percentage value to apply to all the Prices"
        End If
    Else
        MsgBox "Change Percentage cannot be blank"
    End If
    End Sub

  32. #72

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    Quote Originally Posted by The Welshman View Post
    Doogle's code in #25 shows opening a recordset that works.
    Try using that as a basis for what you are doing here.
    welshman .. dude i am trying to do what he says but i can't figure out .. it's very hard to do it my self , at the same time i keep trying to learn something and to figure out what is this and what is that for ...
    anyway i think i am getting closer )
    i just need a little push in here

    thanks for the replay

  33. #73
    Member
    Join Date
    Nov 2012
    Posts
    62

    Re: code error 09 in vb 6 accounting system

    You dont need the 'with ar', its a shortcut when you're using properties of ar repeatedly.
    Also you might need to declare criteria.

    Other than that it looks like it should do what you want.

  34. #74

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    i did like this one ...

    as this code to delete a db

    Code:
    Call dbconek
    With ar
    criteria = "Select *From tblartikujt Where barkodi ='" & txtbar & "'"
    .Open criteria, strConek, adOpenStatic, adLockOptimistic
    !barkodi = txtbarkodi
    !pershkrimi = txtpershkrimi
    !furnizuesi = lblsupp
    !kategoria = lblcat
    !qmimi = txtblerja
    !sasia = txtsasia
    !tvsh = txtvat
    !qmimi_shitjes = txtshitja
    .Delete
    MsgBox "The article was deleted successfully.", vbInformation, "Fshirja!"
    .Close
    End With
    lv.Refresh
    End If
    End If
    lv.ListItems.Remove (lv.SelectedItem.Index)
    End Sub

  35. #75

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    man please

  36. #76
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    You still don't seem to have got the hang of telling us what the problem actually is and where it's happening.

    What is the code in Post#74 meant to do, what is the error message and on what line is it happening?

  37. #77

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    this is the code i end up with to change the prices but it's not working
    Code:
    Private Sub cmdChangePrice_Click()
    Call dbconek
    With ar
    Dim curDelta As Currency
    Dim rs As ADODB.Recordset
    If txtDeltaPrice.Text <> "" Then
        If IsNumeric(txtDeltaPrice.Text) Then
            curDelta = CCur(txtDeltaPrice.Text)
            Set rs = New ADODB.Recordset
            criteria = "Select *From tblArtikujt Where qmimi_shitjes='" & frmArtLista.txtDeltaPrice & "'"
            rs.Open criteria, strConek, adOpenStatic, adLockOptimistic
            If Not (rs.BOF And rs.EOF) Then
                Do Until rs.EOF
                    rs![qmimi_shitjes] = rs![qmimi_shitjes] + (curDelta * rs![qmimi_shitjes] / 100)
                    rs.Update
                    rs.MoveNext
                Loop
            End If
        Else
            MsgBox "Please enter a numeric percentage value to apply to all the Prices"
        End If
    Else
        MsgBox "Change Percentage cannot be blank"
    End If
    End Sub
    how i end up with this code ...
    i was looking on this one and did almost the same as it is mix with your code
    Code:
    Call dbconek
    With ar
    criteria = "Select *From tblartikujt Where barkodi ='" & txtbar & "'"
    .Open criteria, strConek, adOpenStatic, adLockOptimistic
    !barkodi = txtbarkodi
    !pershkrimi = txtpershkrimi
    !furnizuesi = lblsupp
    !kategoria = lblcat
    !qmimi = txtblerja
    !sasia = txtsasia
    !tvsh = txtvat
    !qmimi_shitjes = txtshitja
    .Delete
    MsgBox "The article was deleted successfully.", vbInformation, "Fshirja!"
    .Close
    End With
    lv.Refresh
    End If
    End If
    lv.ListItems.Remove (lv.SelectedItem.Index)
    End Sub

  38. #78

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    this is your code but can't make it working ..!

    Code:
    Private Sub cmdChangePrice_Click()
    Dim strConek As String
    Dim curDelta As Currency
    Dim rs As ADODB.Recordset
    If txtDeltaPrice.Text <> "" Then
        If IsNumeric(txtDeltaPrice.Text) Then
            curDelta = CCur(txtDeltaPrice.Text)
            Set RS = New ADODB.RecordSet
    strConek = "SELECT qmimi_shitjes FROM tbdArtikujt"
    RS.Open strConek, dbconek, adOpenStatic, adLockOptimistic
            If Not (rs.BOF And rs.EOF) Then
                Do Until rs.EOF
                    rs![qmimi_shitjes] = rs![qmimi_shitjes] + (curDelta * rs![qmimi_shitjes] / 100)
                    rs.Update
                    rs.MoveNext
                Loop
            End If
        Else
            MsgBox "Please enter a numeric percentage value to apply to all the Prices"
        End If
    Else
        MsgBox "Change Percentage cannot be blank"
    End If
    End Sub

  39. #79

    Thread Starter
    Lively Member
    Join Date
    Jun 2013
    Posts
    64

    Re: code error 09 in vb 6 accounting system

    errors are still the same as usual.
    Name:  doogle10.jpg
Views: 1470
Size:  34.0 KBName:  doogle11.jpg
Views: 1438
Size:  134.1 KB

  40. #80
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: code error 09 in vb 6 accounting system

    Please post the code for subroutine dbconek

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width