This code works like a champ in Office 365 Access 32/Windows 10.
It builds a string of tags in a memo field on the parent form and copies it to the clipboard.
Like #architecture #building #abandoned etc.
However in Access 64/Windows 11 it behaves erratically. It usually stops at 3 tags.
Any suggestions what might be the problem here?
All suggestions will be appreciated.
It builds a string of tags in a memo field on the parent form and copies it to the clipboard.
Like #architecture #building #abandoned etc.
However in Access 64/Windows 11 it behaves erratically. It usually stops at 3 tags.
Any suggestions what might be the problem here?
All suggestions will be appreciated.
Code:
Public Sub GenerateList()
On Error GoTo ErrorHandler
DoCmd.RunCommand acCmdSaveRecord
Forms![frmTaglist]![ST_String] = ""
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT * FROM qrySelected")
Dim MaxChar As Integer
MaxChar = DMax("Set_MaxChar", "tblSettings")
Dim TagSTR As String
Dim TempSTR As String
'Check to see if the recordset actually contains rows
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst
Do Until rs.EOF = True
TagSTR = " #" & rs!Tag_Name
Forms![frmTaglist]![ST_String] = Forms![frmTaglist]![ST_String] & TagSTR
Forms![frmTaglist]![txtCharacters] = Len(Forms![frmTaglist]![ST_String])
Forms![frmTaglist]![ST_String].SetFocus
DoCmd.RunCommand acCmdCopy
If Len(Forms![frmTaglist]![ST_String]) > MaxChar Then
Forms![frmTaglist]![ST_String].ForeColor = vbRed
Forms![frmTaglist]![txtCharacters].ForeColor = vbRed
Else
Forms![frmTaglist]![ST_String].ForeColor = vbBlack
Forms![frmTaglist]![txtCharacters].ForeColor = vbBlack
End If
rs.MoveNext
Loop
Else
MsgBox "No tags have been selected yet! "
End If
rs.Close 'Close the recordset
Set rs = Nothing 'Clean up
Forms![frmTaglist]![ST_String].SetFocus
DoCmd.RunCommand acCmdCopy
Me.fldHidden.SetFocus
ExitHandler:
Exit Sub
ErrorHandler:
Select Case Err
Case 0
'MsgBox "Action cannot be completed! ", vbExclamation, ""
Resume ExitHandler
Case Else
'MsgBox Err.Description, vbExclamation, "Error #: " & Err.Number
Resume ExitHandler
End Select
End Sub