Hi, i wrote a procedure and function. I transfer this function into procedure. If i try execute procedure i have an error: argument not optional on this function.
Code:
Public Function inserthgbstshow(level As String, relation As Long) As String
Dim funObjid As Long
funObjid_show = pobierz_objid(ptype_id_inserthgbstshow)
conn.Execute "insert into table_hgbst_show(OBJID, LAST_MOD_TIME, TITLE, DEV_VAL, DEV, CHLD_PRNT2HGBST_SHOW) values (" + funObjid_show + ", to date(1753-01-01), '" + level + "', 0, "", " + relation + ")"
inserthgbstshow = funObjid_show
End FunctionCode:
Sub Zaimportuj()
Dim objid_show_level_1 As Long
Dim objid_show_level_2 As Long
Dim objid_show_level_3 As Long
Dim objid_show_level_4 As Long
Dim objid_show_level_5 As Long
Dim last_name_level_1 As String
Dim last_name_level_2 As String
Dim last_name_level_3 As String
Dim last_name_level_4 As String
Dim last_name_level_5 As String
objid_show_level_1 = pobierz_list
delete_dane
last_name_level_1 = ""
last_name_level_2 = ""
last_name_level_3 = ""
last_name_level_4 = ""
last_name_level_5 = ""
Dim c As Object
With Sheets(1).Range("A:A")
Set c = .Find(what:="*", LookIn:=xlValues, LookAt:=xlPart, searchorder:=xlByRows, searchdirection:=xlPrevious)
End With
MsgBox ("Ostatni zapisany wiersz to: " & c.Row)
Dim x As Integer
x = 3
For x = 3 To c.Row
If Range("B" + CStr(x)) <> "" Then
inserthgbstelement
inserthgbstelm0hgbstshow1
If Range("D" + CStr(x)) <> "" Then
If last_name_level_1 <> Range("A" + CStr(x)) Then
objid_show_level_2 = inserthgbstshow
End If
inserthgbstelement
inserthgbstelm0hgbstshow1
If Range("F" + CStr(x)) <> "" Then
If last_name_level_2 <> Range("C" + CStr(x)) Then
objid_show_level_3 = inserthgbstshow
End If
inserthgbstelement
inserthgbstelm0hgbstshow1
If Range("H" + CStr(x)) <> "" Then
If last_name_level_3 <> Range("E" + CStr(x)) Then
objid_show_level_4 = inserthgbstshow
End If
inserthgbstelement
inserthgbstelm0hgbstshow1
If Range("J" + CStr(x)) <> "" Then
If last_name_level_4 <> Range("G" + CStr(x)) Then
objid_show_level_5 = inserthgbstshow
End If
inserthgbstelement
inserthgbstelm0hgbstshow1
End If
End If
End If
End If
last_name_level_1 = Range("A" + CStr(x))
last_name_level_2 = Range("C" + CStr(x))
last_name_level_3 = Range("E" + CStr(x))
last_name_level_4 = Range("G" + CStr(x))
last_name_level_5 = Range("I" + CStr(x))
End If
Next x
End Sub