PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
the program doesn't work right. it must took values from file Avto_a.accdb from third-VBForums
Results 1 to 3 of 3

Thread: the program doesn't work right. it must took values from file Avto_a.accdb from third

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2019
    Posts
    24

    the program doesn't work right. it must took values from file Avto_a.accdb from third

    the program doesn't work right. it must took values from file Avto_a.accdb from third colums from table TOYOTA_95_TS18.csv for example value PT92542130 give 20 and in result file must be 20 but we recieve 0.02 in output file.

    VB Code:
    1. Private Sub Вес_Click()
    2.         Dim rs As ADODB.Recordset, Фирма1 As String
    3.         Фирма1 = Nz(DLookup("Фирма1", "Итого"))
    4.         Set rs = New ADODB.Recordset
    5.         rs.Open "select nm_tabl From tb_tabl Where vkl = 3 order By nm_tabl", CurrentProject.Connection, adOpenDynamic, adLockOptimistic, adCmdTableDirect
    6.         With rs
    7.             Do While Not .EOF
    8.                 SysCmd acSysCmdSetStatus, "Обработка таблицы: " & !nm_tabl
    9.                 CurrentDb.QueryDefs("Вес").SQL = "UPDATE " & !nm_tabl & " INNER JOIN Итого ON (" & !nm_tabl & ".Поле1 = Итого.Артикул) AND (" & !nm_tabl & ".Поле2 = Итого.Фирма) SET Итого.Вес = [" & !nm_tabl & "].[Поле3]"
    10.                 CurrentDb.Execute "Вес"
    11.                 .MoveNext
    12.             Loop
    13.             If Фирма1 <> "" Then
    14.                 .MoveFirst
    15.                 Do While Not .EOF
    16.                     SysCmd acSysCmdSetStatus, "Обработка таблицы: " & !nm_tabl
    17.                     CurrentDb.QueryDefs("Вес").SQL = "UPDATE " & !nm_tabl & " INNER JOIN Итого ON (" & !nm_tabl & ".Поле1 = Итого.Артикул) AND (" & !nm_tabl & ".Поле2 = Итого.Фирма1) SET Итого.Вес = [" & !nm_tabl & "].[Поле3]"
    18.                     CurrentDb.Execute "Вес"
    19.                     .MoveNext
    20.                 Loop
    21.             End If
    22.         End With
    23.         rs.Close
    24.         MsgBox ("Вес сформирован")
    25.  
    26.     End Sub
    here program complete files
    Last edited by FunkyDexter; Aug 13th, 2019 at 02:16 AM.

  2. #2
    Fanatic Member
    Join Date
    Feb 2003
    Posts
    725

    Re: the program doesn't work right. it must took values from file Avto_a.accdb from t

    Quote Originally Posted by daveramsey View Post
    the program doesn't work right. it must took values from file Avto_a.accdb from third colums from table TOYOTA_95_TS18.csv for example value PT92542130 give 20 and in result file must be 20 but we recieve 0.02 in output file.

    Private Sub Вес_Click()
    Dim rs As ADODB.Recordset, Фирма1 As String
    Фирма1 = Nz(DLookup("Фирма1", "Итого"))
    Set rs = New ADODB.Recordset
    rs.Open "select nm_tabl From tb_tabl Where vkl = 3 order By nm_tabl", CurrentProject.Connection, adOpenDynamic, adLockOptimistic, adCmdTableDirect
    With rs
    Do While Not .EOF
    SysCmd acSysCmdSetStatus, "Обработка таблицы: " & !nm_tabl
    CurrentDb.QueryDefs("Вес").SQL = "UPDATE " & !nm_tabl & " INNER JOIN Итого ON (" & !nm_tabl & ".Поле1 = Итого.Артикул) AND (" & !nm_tabl & ".Поле2 = Итого.Фирма) SET Итого.Вес = [" & !nm_tabl & "].[Поле3]"
    CurrentDb.Execute "Вес"
    .MoveNext
    Loop
    If Фирма1 <> "" Then
    .MoveFirst
    Do While Not .EOF
    SysCmd acSysCmdSetStatus, "Обработка таблицы: " & !nm_tabl
    CurrentDb.QueryDefs("Вес").SQL = "UPDATE " & !nm_tabl & " INNER JOIN Итого ON (" & !nm_tabl & ".Поле1 = Итого.Артикул) AND (" & !nm_tabl & ".Поле2 = Итого.Фирма1) SET Итого.Вес = [" & !nm_tabl & "].[Поле3]"
    CurrentDb.Execute "Вес"
    .MoveNext
    Loop
    End If
    End With
    rs.Close
    MsgBox ("Вес сформирован")

    End Sub

    here program complete files
    Use code tags. And why aren't you using this forum's attachment feature? EDIT: Also you can use "Do Until" instead "Do While Not".
    Last edited by Peter Swinkels; Aug 13th, 2019 at 08:18 AM. Reason: Added a comment.

  3. #3
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,352

    Re: the program doesn't work right. it must took values from file Avto_a.accdb from t

    I've added code tags. In the future you can do this yourself using the # or VB buttons. It makes your post easier to read and increases the chance someone will help you.

    I also removed the links from your post. In general we would ask you to attach files to your post rather than linking to them elsewhere. There's a few reasons for this but chief among them is that it helps us protect ourselves against people posting viruses etc. (it's been done before). You should only link to a file if it is very large and exceeds our attachment limits and then it should be to a well known code sharing site e.g. GitHub.

    @Peter, I also removed the links from your quoted post.
    You can depend upon the Americans to do the right thing. But only after they have exhausted every other possibility - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width