View Full Version : [SOLVED:] What does this section of code do
Aussiebear
06-30-2024, 03:34 PM
I have been reviewing some old code within the forum and came across this;
For index = 1 To intI
.Edit
![Flow] = str
.Update
.MoveNext
Next
What does this line represent "![Flow] = Str"?
Paul_Hossler
06-30-2024, 04:17 PM
I know nothing about VBA and Access, but
https://www.msaccesstips.com/2016/07/dots-and-exclamation-marks-usage-with.html
Dots and Exclamation Symbols.General Usages of the dot (.) and exclamation symbol (!) in object references.
A dot (.) - after an object name to access its methods or properties.
The exclamation mark (!) - after an object name, refers to the sub-object or control of the Top-level Object.
but I didn't even understand the examples in the link :crying:
Aussiebear
06-30-2024, 04:36 PM
Okay here's the full code as presented
Option Compare Database
Function een_tabel()
Dim db As dao.Database
Dim opentbl As dao.Recordset
Dim intI As Integer, index As Integer ', teller As Long
Dim dummy As String, dummynext As String, str As String
On Error GoTo ErrorHandler
Set db = CurrentDb
Set opentbl = db.OpenRecordset("Test_old", dbOpenDynaset)
If opentbl.EOF Then Exit Function
'teller = 0
With opentbl
Do Until .EOF
intI = 1
str = ""
dummy = ![ORDERID]
str = ![Groep_Machines]
.MoveNext
If .EOF Then
dummynext = 1
Else
dummynext = ![ORDERID]
End If
Do Until (dummy <> dummynext)
intI = intI + 1
str = str & "_" & ![Groep_Machines]
dummy = ![ORDERID]
.MoveNext
If .EOF Then
dummynext = 1
Else
dummynext = ![ORDERID]
End If
'dummynext = ![ORDERID]
Loop
For index = 1 To intI
.MovePrevious
Next
For index = 1 To intI
.Edit
![Flow] = str
.Update
.MoveNext
Next
'teller = teller + 1
'If teller = 320000 Then
'MsgBox "stop"
'End If
Loop
End With
opentbl.Close
Set opentbl = Nothing
Set db = Nothing
Exit Function
ErrorHandler:
MsgBox "Fout doorgeven aan Danny" & vbCrLf & vbCrLf & "Error Number: " & _
Err.Number & vbCrLf & "Error Source:" & Error.Source & vbCrLf & "Error Description: " & _
Err.Description, vbCritical, "FOUT!"
Exit Function
End Function
The "![ ...something...]" is used more than once in the code. Lines 15, 16, 21, 25, 26, 31, 33,& 40 within the Function subset. Is it referring to a record within a table?
arnelgp
06-30-2024, 06:20 PM
you are working with recordset from a table (Test_old).
"Flow" is a Text field on your table and each record is being assigned same string (str) to it.
Aussiebear
06-30-2024, 06:39 PM
Thank you
Paul_Hossler
07-01-2024, 09:46 AM
you are working with recordset from a table (Test_old).
"Flow" is a Text field on your table and each record is being assigned same string (str) to it.
I knew some smart Access person would have the answer :thumb
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.