Updating Datafieldvariable with(out) SQL 
Author Message
 Updating Datafieldvariable with(out) SQL

Hallo there,

I have a "little" problem with programming in Access97.
I have a Database with Softwarepackets and have to update userselected
packets.
They are stored in an Column "Kernpakete" in a Datafield ( 7, 11, 33, 33b,
35_K, 22, 3, 5, 8,..... etc.)
I can't get it to work with SQL (it says either nothing and selects nothing
or it fails with "few parameters 1 expected"
So I decided to use konventional programming instead. But I don't know, how
to access a single Datavariable from the field to change it  and update the
whole thing.
It fails with Error 13 Types not compatible!!
What am I missing? Or did I program stupid at all??
Thanx in advance very much!

here's the Code:
(its not yet finished (user selection etc.) First thing was to get the
access and update to work. perhaps with SQL?)
===========================================================

Option Compare Database
Option Explicit

Function Suchen_und_Ersetzen_Paket()
    Dim ws As Workspace
    Dim db As Database
    Dim rsHardware As Recordset
    Dim i, min, max As Long
    Dim dstr, Paket As String
    Dim refKernpaket() As Variant

    Paket = "33"
    dstr = "25"

   ' Set ws = DBEngine.Workspaces(0)
   ' Set db = ws.Databases(0)
   Set db = CurrentDb()
'Version 1 mit SQL    some not working versions  ;-(((((
'==================
   ' Set rsHardware = db.OpenRecordset _
        ("SELECT IP, Masch_Name, Kernpakete FROM RechnerName
WHERE(Kernpakete LIKE Paket)", dbOpenDynaset)
            '("SELECT * FROM RechnerName WHERE '" & Paket & "' IN
Kernpakete.Value")
            '("SELECT * FROM RechnerName WHERE Kernpakete.Value LIKE '" &
Paket & "'")
            'datstring = rsHardware!Kernpakete.Value
    'With rsHardware
            '.Execute ("SELECT Kernpakete FROM rsHardware WHERE Paket IN
Kernpakete.Value")
            '.MoveFirst

'Version 2 mit konventioneller Prog. langsame Version
'=======================================================
    Set rsHardware = db.OpenRecordset("SELECT Kernpakete FROM RechnerName",
dbOpenDynaset)
    With rsHardware
        .MoveLast
        .MoveFirst
        Do Until .EOF
            If Not IsEmpty(!Kernpakete.Value) Then
                max = UBound(!Kernpakete.Value)            'HERE COMES THE
ERROR 13!!!
                min = LBound(!Kernpakete.Value)
                For i = min To max
                    refKernpaket(i) = !Kernpakete.Value(i)
                    If refKernpaket(i) = Paket Then refKernpaket(i) = dstr
                Next
                For i = min To max
                    !Kernpakete.Value(i) = refKernpaket(i)
                Next
            .Update
           End If
        Loop
    End With
End Function



Tue, 25 Dec 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. university EMR send outs

2. on the outs

3. Learning the ins and outs of Peek and Poke

4. How to handle print outs in VB?

5. Filesystem Time outs

6. Session Variable Time-outs

7. Time-outs

8. Need help with time outs

9. Dataset changes updates grid , How to update SQL table

10. 2nd SQL Server update after update text field corrupts row - using RDO

11. Updating data to a memo field using SQL UPDATE

12. SQL Update not Updating

 

 
Powered by phpBB® Forum Software