Hallo gemeinsam!
Nach einer längeren pause wollt ich etwas verbessern, und komme da nicht weiter,
Hat jemand einen Tipp für mich?
In meine Tabelle Sind noch zwei weitere Felder hinzugekommen die sind "Double" weil ich Kommazahlen brauche.
Ich lese diese aus und versuche sie per Makro in einen neuen Datensatz zu schreiben.
Das auslesen klappt gut jedoch das beschreiben klappt nicht gut, den es werden das Komma und die Nachkommastellen abgeschnitten.
Code: Alles auswählen
Sub Restmaterial_Erzeugen
Dim sLsInt1Field as String
Dim sLsInt2Field as String
Dim sLsInt3Field as String
Dim sLsInt4Field as String
Dim oFeld as Object
Dim sLsInt5Field as String
Dim sLsInt6Field as String
Dim sLsInt7Field as String
Dim sLsInt8Field as String
Dim sLsInt9Field as String
Dim sLsInt10Field as String
Dim sLsInt11Field as String
Dim sAntwort as String
Dim IidFiel as String
Dim sLsInt1 as String
Dim sLsInt2 as String
Dim sLsInt3 as String
Dim sLsInt4 as String
Dim sLsInt5 as String
Dim sLsInt6 as String
Dim sLsInt7 as String
Dim sLsInt8 as String
Dim sLsInt9 as String
Dim sLsInt10 as String
Dim sLsInt11 as String
Dim iXs as Integer
Dim dt2 as Double
Dim dt6 as Double
Dim dt7 as Double
Dim dt10 as Double
Dim dt11 as Double
Dim Iid as Integer
oDoc1 = ThisComponent 'Das ist immer so eine Muss-Zeile
oForm1 = oDoc1.drawpage.forms.MainForm
sLsInt1Field = "txtMaterial" 'Feldname des Feldes wo der Folder drinsteht.
sLsInt2Field = "fmtt=" 'Feldname des Feldes wo der Folder drinsteht.
sLsInt3Field = "txtSchmelze" 'Feldname des Feldes wo der Folder drinsteht.
sLsInt4Field = "txtFormat" 'Feldname des Feldes wo der Folder drinsteht.
sLsInt5Field = "fmtMenge" 'Feldname des Feldes wo der Folder drinsteht.
sLsInt6Field = "fmtAbmass X" 'Feldname des Feldes wo der Folder drinsteht.
sLsInt7Field = "fmtAbmass Y" 'Feldname des Feldes wo der Folder drinsteht.
sLsInt8Field = "Lagerplatz"
sLsInt9Field = "Charge"
sLsInt10Field = "Preis Je Kg"
sLsInt11Field = "Spezifisches Gew"
IidFiel = "fmtID"
Iid = oForm1.getByName(IidFiel).text
sLsInt1 = oForm1.getByName(sLsInt1Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
sLsInt2 = oForm1.getByName(sLsInt2Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
sLsInt3 = oForm1.getByName(sLsInt3Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
sLsInt4 = oForm1.getByName(sLsInt4Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
sLsInt5 = oForm1.getByName(sLsInt5Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
sLsInt6 = oForm1.getByName(sLsInt6Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
sLsInt7 = oForm1.getByName(sLsInt7Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
sLsInt9 = oForm1.getByName(sLsInt9Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
sLsInt10 = oForm1.getByName(sLsInt10Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
sLsInt11 = oForm1.getByName(sLsInt11Field).text'Zellen Inhalt in die Variable neue vorgeschlagene Nummer
oFormFilter = ThisComponent.Drawpage.Forms.Filter
oColumnF_ID = oFormFilter.Columns.F_ID
oColumnF_ID.updatenull
oFormFilter.updateRow
sLsInt4 = "RM"
sLsInt5 = "1"
Spr1:
sLsInt6 = InputBox("Bitte Langes Mass in Millimeter:", "X-Mass", "")
IF sLsInt6 = "" Then
Msgbox "Abgebrochen!"
Exit Sub
End if
Spr2:
sLsInt7 = InputBox("Bitte kurzes Mass in Millimeter:", "Y-Mass", "")
IF sLsInt7 = "" Then
Msgbox "Abgebrochen!"
Exit Sub
End if
IF sLsInt6 < sLsInt7 then
Msgbox " X = Langes Mass und nicht ander herum!!!"+ Chr(13)+ _
" Und deswegen machen wir das noch einmal!"
goto Spr1
End if
sLsInt8 = InputBox("Neuen Lagerplatz angeben!", "")
IF sLsInt8 = "" Then
Msgbox "Abgebrochen!"
Exit Sub
End if
iXs = sLsInt6
If iXs > 4000 then
Msgbox "Falscheingabe!!! X-Mass!"
goto Spr1
endif
iXs = sLsInt7
If iXs > 4000 then
Msgbox "Falscheingabe!!! Y-Mass!"
goto Spr2
endif
dt2 = CDbl(sLsInt2)
dt6 = CDbl(sLsInt6)
dt7 = CDbl(sLsInt7)
dt10 = CDbl(sLsInt10)
dt11 = CDbl(sLsInt11)
oForm1.moveToInsertRow()
oForm1.getByName(sLsInt1Field).BoundField.updateString(sLsInt1)
oForm1.getByName(sLsInt2Field).BoundField.updateDouble(dt2)
oForm1.getByName(sLsInt7Field).BoundField.updateDouble(dt7)
oForm1.getByName(sLsInt3Field).BoundField.updateString(sLsInt3)
oForm1.getByName(sLsInt4Field).BoundField.updateString(sLsInt4)
oForm1.getByName(sLsInt5Field).BoundField.updateString(sLsInt5)
oForm1.getByName(sLsInt6Field).BoundField.updateDouble(dt6)
oForm1.getByName(sLsInt8Field).BoundField.updateString(sLsInt8)
oForm1.getByName(sLsInt9Field).BoundField.updateString(sLsInt9)
oForm1.getByName(sLsInt10Field).BoundField.updateDouble(sLsInt10)
oForm1.getByName(sLsInt11Field).BoundField.updateDouble(sLsInt11)
oForm1.InsertRow()'NEUE ZEILE, neue ID
nID = oForm1.Columns.ID.getint
oColumnF_ID.updateint(nID)'Neue ID in Filtertabelle eintragen -> Damit stimmt die Abfrage für den Ausdruck und muss nicht mehr per Makro erzeugt werden.
oFormFilter.updateRow
oForm1.reload
Das Problem ist das ich Das Feld aus meinem Formular als String auslese und auch als string wieder beschreibe.
Code: Alles auswählen
oForm1.getByName(sLsInt10Field).BoundField.updateString(sLsInt10)
oForm1.getByName(sLsInt11Field).BoundField.updateString(sLsInt11)
Das scheint das Komma abzuschneiden und die Nachkomma wegzuschmeißen.
aber das geht auch nicht
Code: Alles auswählen
oForm1.getByName(sLsInt10Field).BoundField.updateDouble(sLsInt10)
oForm1.getByName(sLsInt11Field).BoundField.updateDouble(sLsInt11)
Das dazu klappt auch nicht
Es dreht sich nur um "sLsInt10Field = "Preis Je Kg" und
sLsInt11Field = "Spezifisches Gew"
" die nachträglich eingefügt wurden.
Löscht man alles was dieses betrifft, funktioniert auch das makro wieder.
jemand eine Idee?