I'm using a MS Access database linked with a Sharepoint Server. MS Access Forms as FrontEnd and Sharepoint Lists as BackEnd.
Today i can see all the informations from the lists using access forms, without problems.
What i need:
I'm trying to insert new registers on the list, using a SQL command: "INSERT INTO..."
if there is another possibility to insert the record in the list, may be useful
What's happening?
When i call the DoCmd.RunSQL(txtsql), i receive a runtime error 3999 saying i'm disconnected from the server.
My code now:
I tried using recordsets, but didn't succeed. I need to run this SQL many times, changing the string "txtSql" inside a loop. Like this:
Dim MaxSonda As Integer 'Get the max ID from the list MaxSonda = Nz(DMax("IdSonda", "Sondas", "((Sondas.[Tipo Sonda])<>1 Or (Sondas.[Tipo Sonda]) Is Null)"), 0) MsgBox "MaxSonda = " & MaxSonda 'Run the code for each "sonda" Do While MaxSonda > 1 If Nz(DLookup("[Tipo Sonda]", "Sondas", "Sondas!IdSonda = " & MaxSonda), 1) <> 1 Then DoCmd.OpenTable "Resumo", acViewNormal, acAdd DoCmd.GoToRecord acDataTable, "Resumo", acNewRec txtSql = "INSERT INTO Resumo ( Data, Sonda, Status ) SELECT #" & LastData + 1 & "#, " & MaxSonda & ", 0;" MsgBox txtSql DoCmd.RunSQL txtSql DoCmd.Close acTable, "Resumo", acSaveYes End If MaxSonda = MaxSonda - 1 Loop
P.S.: The MsgBox is just for check the steps
thanks for help