Форумы HiProg.com - MS ACCESS, VBA, VB

 

Ответить на сообщение

Вернуться к теме

Вы отвечаете на сообщение:

ник: silich
генератор ваших данных, например

'-- Task Tabl3K
Function rnd999()
Randomize
rnd999 = Int((999 * Rnd))
End Function

Function rnd99()
Randomize
rnd99 = Int((99 * Rnd))
End Function

Function rndAz(Optional upperbound = 254, _
               Optional lowerbound = 192, _
               Optional asChar As Boolean = True)
Dim ir&
On Error GoTo err123
Randomize
ir = CInt(Math.Round((upperbound - lowerbound + 1) * Rnd())) + lowerbound
If asChar Then
    rndAz = Chr(ir)
Else
    rndAz = CInt(ir) + lowerbound
End If
Exit Function
err123:
    rndAz = "#"
Exit Function
End Function

Function task_Tabl3k(Optional cRec& = 1, _
                     Optional dmode As Boolean = True)
Dim rs As DAO.Recordset
Dim i&, j&, ii&, s&, sr&, tel$, am@, note$
On Error GoTo err123
If cRec < 1 Then cRec = 1
If dmode = False Then CurrentDb.Execute "delete * from Tabl", dbFailOnError
SysCmd acSysCmdSetStatus, "заполнено: " & 0 & " из " & cRec
For i = 1 To cRec
    tel = "(" & Format(rnd99(), "000") & ")" & Format(rnd99(), "00") & "-" & Format(rnd999(), "000") & "-" & Format(rnd999(), "000")
    am = rnd99() / 100
    note = ""
    ii = CInt(Math.Round((50) * Rnd())) + 1
    For j = 0 To ii
        s = CInt(Math.Round((ii) * Rnd()))
        If s = 0 Then s = 1
        If j Mod s = 0 Then
            note = note & Chr(32)
        End If
        note = note & rndAz()
    Next j
    sr = (Math.Round((cRec - 1 + 1) * Rnd()))
    If sr > 0 Then
        If sr Mod 2 = 0 Then
            note = Replace(note, " ", "рег ")
        End If
    End If
    note = Left(LTrim(note), 255)
    If dmode = True Then
        Debug.Print "tel=" & tel, "am=" & am, "note=" & note
    Else
        CurrentDb.Execute "insert into Tabl(nomertel,summazvonka,opisanie) " & _
                          "values('" & tel & "'," & am & ",'" & note & "')", dbFailOnError
    End If
    SysCmd acSysCmdSetStatus, "заполнено: " & i & " из " & cRec: DoEvents
Next i
Exit Function
err123:
MsgBox Error, , "task_Tabl3k"
SysCmd acSysCmdClearStatus
Exit Function
End Function

пока заполняю таблицу 2мя миллионаме


Ваше имя:

Пароль:

Цитировать: [quote][/quote] Код: [code][/code]
Жирный: [b][/b] Наклонный: [i][/i]
URL: [url][/url] 

Сообщение:

 Размер файла не более 50 Кбт. Большие файлы можно размещать на www.slil.ru

Прикрепить:

 

Для вставки смайлов в текст щелкните по значку.