If Len (Dir$ (StrPath)) = 0 Then
MsgBox "Файл бланка формы '" & StrFormName & "' " & StrPath & " не обнаружен!", vbCritical + vbOKOnly
Set Rec = db. OpenRecordset ("SELECT Параметры. *, Сотрудники. Сотрудник, Сотрудники. ТабельныйНомер, Должности. Должность FROM ( (Должности RIGHT JOIN Сотрудники ON Должности. НомерДолжн = Сотрудники. НомерДолжн) RIGHT JOIN Параметры ON Сотрудники. НомерСотр = Параметры. ИнвОтвеств)", dbOpenSnapshot)
StrFirmName = Nz (Rec. Fields ("НаименованиеФирмы"). Value, "")
StrFirmOKPO = Nz (Rec. Fields ("ОКПО"). Value, "")
StrInvOtvName = Nz (Rec. Fields ("Сотрудник"). Value, "")
StrInvOtvDolzhn = Nz (Rec. Fields ("Должность"). Value, "")
StrInvOtvNomer = Nz (Rec. Fields ("ТабельныйНомер"). Value, "")
MsgBox "Общие параметры фирмы не занесены!", vbCritical + vbOKOnly
Set Rec = db. OpenRecordset ("select * from ВспомДата where НомерМес = " & Month (v_dat1), dbOpenSnapshot)
StrMonth1 = Nz (Rec. Fields ("НазвМес"). Value, "")
StrMonth1 = "нет названия"
Set Rec = db. OpenRecordset ("select * from ВспомДата where НомерМес = " & Month (v_dat2), dbOpenSnapshot)
StrMonth2 = Nz (Rec. Fields ("НазвМес"). Value, "")
StrMonth2 = "нет названия"
Set oApp = CreateObject ("Excel. Application")
oApp. Workbooks. Open FileName: =StrPath, ReadOnly: =True
oApp. ActiveWorkbook. Sheets (1). Select
oApp. Cells (rFirmName, cFirmName). Value = StrFirmName
oApp. Cells (rFirmOKPO, cFirmOKPO). Value = StrFirmOKPO
oApp. Cells (rStruct, cStruct). Value = StrStruct
oApp. Cells (rDat1Day, cDat1Day). Value = Format$ (v_dat1, "dd")
oApp. Cells (rDat1Mon, cDat1Mon). Value = StrMonth1
oApp. Cells (rDat1Year, cDat1Year). Value = Right$ (Format$ (v_dat1, "yyyy"),
1)
oApp. Cells (rDat2Day, cDat2Day). Value = Format$ (v_dat2, "dd")
oApp. Cells (rDat2Mon, cDat2Mon). Value = StrMonth2
oApp. Cells (rDat2Year, cDat2Year). Value = Right$ (Format$ (v_dat2, "yyyy"),
1)
oApp. Cells (rInvName, cInvName). Value = StrInvOtvName
oApp. Cells (rInvDolzhn, cInvDolzhn). Value = StrInvOtvDolzhn
oApp. Cells (rInvNomer, cInvNomer). Value = StrInvOtvNomer
Application. SysCmd acSysCmdInitMeter, "Вывод информации о товарах", 100
Set qry = db. QueryDefs ("запрос_ИнвКнига2")
Set qry = db. QueryDefs ("запрос_ИнвКнига")
qry. Parameters (1) = nomer_struct
Set RecList = qry. OpenRecordset (dbOpenSnapshot)
NRecord = RecList. RecordCount
NRecord = RecList. RecordCount
Application. SysCmd acSysCmdUpdateMeter, i / NRecord * 100
With oApp. ActiveWorkbook. Sheets (2)
. Cells (p, cNomer). Value = i
. Cells (p, cTovar). Value = Nz (RecList. Fields ("Наименование"). Value, "")
. Cells (p, cInv). Value = Nz (RecList. Fields ("ИнвНомер"). Value, "")
. Cells (p, cOsn). Value = Nz (RecList. Fields ("ОснованиеПринятия"). Value, "")
. Cells (p, cDatePrin). Value = Format$ (Nz (RecList. Fields ("ДатаПринятияКУчету"). Value, Date), "dd. mm. yyyy")
. Cells (p, cStructTov). Value = Nz (RecList. Fields ("СтруктурноеПодразделение"). Value, "")
. Cells (p, cOtv). Value = Nz (RecList. Fields ("Сотрудник"). Value, "")
. Cells (p, cPervStoim). Value = Nz (RecList. Fields ("ПервСтоииость"). Value, 0)
. Cells (p, cSrok). Value = Nz (RecList. Fields ("СрокИспользования"). Value, 0) & "мес."
. Cells (p, cAmort). Value = Nz (RecList. Fields ("Аморт"). Value, 0)
oApp. ActiveWorkbook. Sheets (3). Cells (p, cOstStoim). Value = _
Nz (RecList. Fields ("ОстСтоииость"). Value, 0)
Application. SysCmd acSysCmdRemoveMeter
If Not (oApp Is Nothing) Then oApp. Visible = True
MsgBox Err. Description, vbCritical + vbOKOnly
Код модуля общий
Function translateNumber (ByVal Num As Long) As String
For razr_count = 1 To razr_all Step 3
kstr1 = Mid (num_str, razr_all - razr_count + 1,1)
If razr_count = 1 Then mgl = True
If razr_count >= razr_all Then GoTo m1
If Mid (num_str, razr_all - razr_count,
1) = "1" Then
translateNumber = " тысяч" & translateNumber
m1: If kstr1 = "1" Then translateNumber = " тысяча" & translateNumber
If kstr1 = "2" Then translateNumber = " тысячи" & translateNumber
If kstr1 = "3" Then translateNumber = " тысячи" & translateNumber
If kstr1 = "4" Then translateNumber = " тысячи" & translateNumber
If (Val (kstr1) >= 5) Or (kstr1 = "0") Then translateNumber = " тысяч" & translateNumber
If kstr1 = "1" Then translateNumber = " миллион" & translateNumber
If kstr1 = "2" Then translateNumber = " миллиона" & translateNumber
If kstr1 = "3" Then translateNumber = " миллиона" & translateNumber
If kstr1 = "4" Then translateNumber = " миллиона" & translateNumber
If (Val (kstr1) >= 5) Or (kstr1 = "0") Then translateNumber = " миллионов" & translateNumber
If kstr1 = "1" Then translateNumber = " миллиард" & translateNumber
If kstr1 = "2" Then translateNumber = " миллиарда" & translateNumber
If kstr1 = "3" Then translateNumber = " миллиарда" & translateNumber
If kstr1 = "4" Then translateNumber = " миллиарда" & translateNumber
If (Val (kstr1) >= 5) Or (kstr1 = "0") Then translateNumber = " миллиардов" & translateNumber
If kstr1 = "1" Then translateNumber = " триллион" & translateNumber
If kstr1 = "2" Then translateNumber = " триллиона" & translateNumber
If kstr1 = "3" Then translateNumber = " триллиона" & translateNumber
If kstr1 = "4" Then translateNumber = " триллиона" & translateNumber
If (Val (kstr1) >= 5) Or (kstr1 = "0") Then translateNumber = " триллионов" & translateNumber
If razr_all - razr_count - 1 < 1 Then
translateNumber = triade (Mid (num_str, 1, razr_all - razr_count + 1), mgl) & translateNumber
translateNumber = triade (Mid (num_str, razr_all - razr_count - 1,3), mgl) & translateNumber
translateNumber = ucasefirst (translateNumber)
Function triade (ByVal in_str As String, mg As Boolean) As String
Dim di As String, kstr1 As String
If Len (in_str) < 3 Then in_str = "0" & in_str
If Len (in_str) < 3 Then in_str = "0" & in_str
If kstr1 = "0" Then out_tri3 = ""
If kstr1 = "1" Then out_tri3 = " сто"
If kstr1 = "2" Then out_tri3 = " двести"
If kstr1 = "3" Then out_tri3 = " триста"
If kstr1 = "4" Then out_tri3 = " четыреста"
If kstr1 = "5" Then out_tri3 = " пятьсот"
If kstr1 = "6" Then out_tri3 = " шестьсот"
If kstr1 = "7" Then out_tri3 = " семьсот"
If kstr1 = "8" Then out_tri3 = " восемьсот"
If kstr1 = "9" Then out_tri3 = " девятьсот"
'оцениваем на 11
2): kstr1 = Mid (in_str, 2,1)
If di = "10" Then out_tri2 = " десять"
If di = "11" Then out_tri2 = " одиннадцать"
If di = "12" Then out_tri2 = " двенадцать"
If di = "13" Then out_tri2 = " тринадцать"
If di = "14" Then out_tri2 = " четырнадцать"