I am trying to work with MSAccess through the use of ADOBC with VB6. I am having trouble with modifying current values.
I have 3 input text fields in the form. FCUIPADDRESS, MCASTIPADDRESSA, MCASTIPADDRESSB. The MCASTIPADDRESSA+B are associated with the FCUIPADDRESS.
For example: 204.168.11.234, 192.168.1.1, 192.168.1.2
I also have the same fields in MS Access(3 columns)
I want to check if the FCUIPADDRESS value exist in the FCUIPADDRESS column, if it exist then go to the MCASTIPADDRESSA+B that is associated with that FCUIPADDRESS and update it. The MCASTIPADDRESSA+B should be in the same row as the FCUIPADDRESS.
If it does not exist then add all three values into each column in Access.
Thanks.
If rstRecordSet.EOF = False Then
'
'Move to the first record
'
rstRecordSet.MoveFirst
'This checks if the FCUIP data exist. If so, it will update.
Do
If (rstRecordSet.Fields("FCUIPAddress")) = Text1.Text Then
Exit Do
End If
rstRecordSet.MoveNext
i = i + 1
Loop Until rstRecordSet.EOF = True
'This will move the cursor to the correct row if the FCUIP is found or if not then it will go to the last row.
Do
rstRecordSet.MoveFirst
If MoveNext = i Then
With rstRecordSet
'.AddNew
.Fields("FCUIPAddress") = Text1.Text
.Fields("McastIPAddressA") = Text2.Text
.Fields("McastIPAddressB") = Text3.Text
.Update
End With
End If
MoveNext = MoveNext + 1
rstRecordSet.MoveNext
Loop Until MoveNext = i + 1
rstRecordSet.Close
End If
'
conConnection.Close
'
'Release your variable references
'
Set conConnection = Nothing
Set cmdCommand = Nothing
Set rstRecordSet = Nothing