使用 Access 以特定格式显示文件夹名称

Displaying folder name in a specific format using Access

我是一个带有按钮和以下文本框的“创建客户”表单:txtCustomerID、txtFirstName、txtLastName、txtPhone、txtEmail。当我单击该按钮时,文本框中键入的信息将插入到 [Customer] table 中,并根据 txtCustomerID、txtFirstName 和 txtLastName 的值创建一个文件夹。例如,如果..

txtCustomerID:100

txtFirstName:罗恩

txt姓氏:史密斯

我希望文件夹名称显示“100 - Ron Smith”,但我找不到解决方案。

下面是我使用的代码,它运行良好,只是无法按照我想要的方式显示文件夹名称。

Private Sub btnCreate_Click()
    DoCmd.RunSQL "INSERT INTO [Customer] (CustomerID, FirstName, LastName, Phone, Email) VALUES ('" & Me.txtCustomerID & "', '" & Me.txtFirstName & "', '" & Me.txtLastName & "', '" & Me.txtPhone & "', '" & Me.txtEmail & "')"

    MkDir ("C:\Users\Desktop\" & txtCustomerID.Value & txtFirstName.Value & txtLastName.Value)
End Sub

任何帮助或建议都会很棒。谢谢

MkDir ("C:\Users\Desktop\" & txtCustomerID.Value & " - " & txtFirstName.Value & " " &  txtLastName.Value)

将添加您想要的破折号和空格。

应该和空格一样简单.....

Private Sub btnCreate_Click()
DoCmd.RunSQL "INSERT INTO [Customer] (CustomerID, FirstName, LastName, Phone, Email) VALUES ('" & Me.txtCustomerID & "', '" & Me.txtFirstName & "', '" & Me.txtLastName & "', '" & Me.txtPhone & "', '" & Me.txtEmail & "')"

MkDir ("C:\Users\Desktop\" & txtCustomerID.Value & " - " & txtFirstName.Value & " " & txtLastName.Value)
End Sub