我是一个创建客户表单,带有一个按钮和以下文本框:txtCustomerID,txtFirstName,txtLastName,txtPhone,txtEmail。当我单击该按钮时,在文本框中键入的信息将插入到[Customer]表中,并根据txtCustomerID,txtFirstName和txtLastName的值创建一个文件夹。例如,如果..
txtCustomerID: 100
txtFirstName: Ron
txtLastName:史密斯
我想要显示文件夹名称" 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
任何帮助或建议都会很棒。谢谢
答案 0 :(得分:1)
MkDir ("C:\Users\Desktop\" & txtCustomerID.Value & " - " & txtFirstName.Value & " " & txtLastName.Value)
将添加您想要的短划线和空格。
答案 1 :(得分:1)
应该像放置空间一样简单.....
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