[Filemaker/Visual Basic] Updaten van record lukt niet

Pagina: 1
Acties:

  • semicon
  • Registratie: Augustus 2003
  • Laatst online: 20-08-2025
Hallo,

Ik krijg het maar niet voor elkaar mijn update te laten werken op een filemaker database.
Ik heb voor mij de volgende code
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Private Sub Fruit_Btn_Click()
    Dim req As IRequest
    If Fruit_Pk.Text = "" Then
        Set req = Connect(Insert, "localhost", 591, "fdb", "fmc")

        req.Parts.Add Data("fruit", txt_Fruit.Text)
        req.Parts.Add Data("color", txt_ColorRGB.Text)
        req.Execute
        StatusBar.SimpleText = txt_Fruit.Text & " Added."
        txt_Fruit.Text = ""
        Fruit_Btn.Caption = "Add"
    Else
        Set req = Connect(search, "localhost", 591, "fdb", "fmc")
        req.Parts.Add Query("!pk", Fruit_Pk.Text)

        Dim Rs As IRecordset
        Set Rs = req.Execute
        
        Rs("fruit") = txt_Fruit.Text
        Rs("color") = txt_ColorRGB.Text
        Rs.Update

        StatusBar.SimpleText = txt_Fruit.Text & " Editted."
        Set Rs = Nothing
    End If
    Set req = Nothing
End Sub


Het gaat bij het runnen van de application fout op deze regel

code:
1
        Set req = Connect(search, "localhost", 591, "fdb", "fmc")


Als melding "invalid command parameter for connect". Wat ik nou zo raar vindt, in mijn application heb ik een search die exact hetzeflde connect, maar het wel doet.

Eventueel deze code die wel werkt?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Private Sub Search_Btn_Click()
    Dim req As IRequest
    
    Set req = Connect(search, "localhost", 591, "fdb", "fmc")
    req.Parts.Add Query("fruit", Search_Str.Text)

    Dim Rs As IRecordset
    Set Rs = req.Execute
    
    Search_Result_List.Clear
    Do While Rs.MoveToNext
        
        Search_Result_List.AddItem Rs.Fields("fruit").Value & " " & Rs.Fields("color").Value
        Search_Result_List.ItemData(Search_Result_List.NewIndex) = Rs.Fields("!pk").Value
    Loop
    Set Rs = Nothing
End Sub


Misschien dat iemand mij kan helpen? O-)