Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
Es ist, dass die RecordSet nach ein mal Laufe in for Schleife geschlossen werden muss und dann wieder geöffnet wird..
Public Function save_database()
DoCmd.Hourglass True
'----------------------------------------------------------------------------
'| This Method saves all Parameters into the Database |
'----------------------------------------------------------------------------
Dim connection As New ADODB.connection ' Create a new ADODB-Connection
Dim RS As New Recordset ' Define a Recordset
Dim sql_str As String ' Create the SQL String
Dim con_str As String ' Create the Connection String
Dim Antwort As Variant
Dim db_path As String
db_path = read_backend_path() ' Set path of database
'Verbindung Erstellen
con_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db_path
connection.Open con_str
sql_str = "SELECT Count (*) As Anz FROM ap_main WHERE ID = " & ID & " AND PROJECT_ID = " & CLng(project_ID) & ""
' Datensätze Ändern oder Hinzufügen
Set RS = connection.Execute(sql_str) ' oder rs.AddNew für Neuanlage
'Zugriff auf Tabelle definieren
If RS!anz <> 0 Then
sql_str = "UPDATE ap_main SET title = '" & title & "', accounting = '" & accounting & "', project_manager = '" & project_manager & "', siglum = '" & siglum & "', description = '" & description & "' WHERE ap_number = " & ap_number & ""
Else
sql_str = "INSERT INTO ap_main (PROJECT_ID,ap_number,title,accounting,project_manager,siglum,description) VALUES ('" & CLng(project_ID) & "','" & ap_number & "','" & title & "','" & accounting & "','" & project_manager & "','" & siglum & "','" & description & "') "
End If
RS.Close
Set RS = connection.Execute(sql_str)
'~~~~~~~~~~ Delete all old Information ~~~~~~~~~~~~~~~~~~~~~~~~~~
sql_str = "DELETE FROM costs WHERE AP_ID = " & ID & ""
Set RS = connection.Execute(sql_str)
'~~~~~~~~~~~~~ Insert new Information into tables ~~~~~~~~~~~~~~~~~~~~~
Dim i As Integer
Dim upper_bnd As Integer
upper_bnd = getUbnd_costs()
For i = 0 To upper_bnd Step 1
If costs_array(i).process <> "" Then
sql_str = "INSERT INTO costs (AP_ID,INTERNAL_ID,siglum,process,type,"
sql_str = sql_str & "description,object,hours,rate,costs,startdate,enddate) "
sql_str = sql_str & "VALUES ('" & ID & "', '" & i & "', '" & costs_array(i).siglum & "', "
sql_str = sql_str & "'" & costs_array(i).process & "', '" & costs_array(i).type & "', "
sql_str = sql_str & "'" & costs_array(i).description & "', '" & costs_array(i).object & "', "
sql_str = sql_str & "" & costs_array(i).hours & ", " & costs_array(i).rate & ", "
sql_str = sql_str & "" & costs_array(i).costs & ", " & Format(costs_array(i).startdate, "\# YYYY-MM-DD \#") & ", " & Format(costs_array(i).enddate, "\# YYYY-MM-DD \#") & ")"
MsgBox sql_str
Set RS = connection.Execute(sql_str) ' Hier entsteht der Fehler!
End If
Next i
connection.Close
If Not RS Is Nothing Then Set RS = Nothing
If Not connection Is Nothing Then Set connection = Nothing
DoCmd.Hourglass False
End Function
INSERT INTO costs (AP_ID,INTERNAL_ID,siglum,process,type,description,object,hours,rate,costs,startdate,enddate) VALUES ('0', '0', 'siglum', 'process', 'Other Exp.', 'desciprtion', 'object', 0, 0, 123324, # 2008-02-07 #, # 2008-02-07 #)