Public Sub RenameTableField(strTable As String, strOldName As String, strNewName As String)
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set db = CurrentDb
Set tdf = db.TableDefs(strTable)
Set fld = tdf.Fields(strOldName)
fld.Name = strNewName
Set fld = Nothing
Set tdf = Nothing
db.Close
Set db = Nothing
End Sub
To understand which separator is used on the computer, you need to look at some real number: what does he have there decimal? – period or comma? I didn't find anything easier than to ask the computer: what time is it? – and convert his answer to Double. This is where his whole background locale will manifest itself. Well, then replace the "incorrect" separator with the correct one in the input string. Actually, the code is below.
Function CdblLocaleIndependent(strNum As String) As Double
Dim decSeparator As String, strDate As String
strDate = CDbl(Now)
If (Len(strDate) - Len(Replace(strDate, ".", ""))) > 0 Then
CdblLocaleIndependent = Replace(strNum, ",", ".")
Else
CdblLocaleIndependent = Replace(strNum, ".", ",")
End If
End Function
In principle, it's not difficult, just try not to make mistakes in the lines that you change. Test not so much the macro as yourself. Create a link to a file. Move the file to another directory. Put the correct replacement lines. Run the macro. Check if the file opens. If it opens, then everything is fine. If not, take a closer look at the replacement and replacement paths.
Sub ChangeHyperLinks()
Dim oldAddr As String, newAddr As String
oldAddr = "Enter here the old part of the file address that needs to be changed, for example \\oldServer"
newAddr = "Enter here the new part of the file address to which you want to change, for example \\newServer"
Dim hprLnk As hyperLink
Dim wSheet As Worksheet
' Call the macro on the sheet where you want to change the hyperlink
Set wSheet = ActiveCell.Worksheet
For Each hprLnk In wSheet.Hyperlinks
hprLnk.Address = Replace(hprLnk.Address, oldAddr, newAddr)
Next hprLnk
MsgBox "The links on the current worksheet have been updated."
End Sub
By default, SQL Server is not configured to be used through mixed authentication.
To set up work not only through Windows Authentication, but also through SQL Server Authentication, you need to do the following:
- In Microsoft SQL Server Management Studio, right-click on the SQL Server instance and select Properties.
- Next, select Security and, among the two «Server Authentication» options, select «SQL Server and Windows Authentication mode» radio button.
- To insert the current date, press Ctrl+; (semi-colon).
- To insert the current time, press Ctrl+Shift+; (semi-colon).
- To insert the current date and time, press Ctrl+; (semi-colon), then press Space, and then press Ctrl+Shift+; (semi-colon).
- In the Start menu, select Run.
- Type "dxdiag".
- The DirectX diagnostic tool opens with a lot of details about the hardware environment of the personal computer.