Access - 将输入框值保存到数据表 (table)
Access - Save inputbox value to datasheet (table)
我遇到了一个问题我尝试了在 Internet 上找到的几种结果,但似乎无法正常工作。
'Pop-up for information where the pv is located and save it to the db
Private Sub Destroyed_pv_Click()
If Me.Destroyed_pv = vbTrue Then
Dim Strg As String, hyperlink_pv_var$
Strg = "Typ your location here..."
Strg = InputBox("Fill in the location of the PV.", "PV Location", Strg)
If Strg = "" Then
hyperlink_pv_var$ = "You didn't fill in the box"
Else
hyperlink_pv_var$ = "Location of the PV is: " &vbNewLine & Strg
End If
MsgBox hyperlink_pv_var$
Else
End If
End Sub
我需要将 hyperlink_pv_var$ 的结果放入我的数据表 (table)
我试过这个
DoCmd.RunSQL "INSERT INTO Registratie formulier.PV_Location"_&"(PV_Location) VALUES "_&"(hyperlink_pv_var$);"
但这行不通。我希望你们能帮我解决这个问题。
干杯,
帕特里克
尝试:
DoCmd.RunSQL "INSERT INTO [Registratie formulier].[PV_Location] " _
& "(PV_Location) VALUES " _
& "('" & hyperlink_pv_var$ & "');"
备注:
- 如果字段、table 或数据库名称包含空格,请括在
[ ]
中
- 此代码假定
hyperlink_pv_var$
始终是一个字符串。
我遇到了一个问题我尝试了在 Internet 上找到的几种结果,但似乎无法正常工作。
'Pop-up for information where the pv is located and save it to the db
Private Sub Destroyed_pv_Click()
If Me.Destroyed_pv = vbTrue Then
Dim Strg As String, hyperlink_pv_var$
Strg = "Typ your location here..."
Strg = InputBox("Fill in the location of the PV.", "PV Location", Strg)
If Strg = "" Then
hyperlink_pv_var$ = "You didn't fill in the box"
Else
hyperlink_pv_var$ = "Location of the PV is: " &vbNewLine & Strg
End If
MsgBox hyperlink_pv_var$
Else
End If
End Sub
我需要将 hyperlink_pv_var$ 的结果放入我的数据表 (table) 我试过这个
DoCmd.RunSQL "INSERT INTO Registratie formulier.PV_Location"_&"(PV_Location) VALUES "_&"(hyperlink_pv_var$);"
但这行不通。我希望你们能帮我解决这个问题。
干杯, 帕特里克
尝试:
DoCmd.RunSQL "INSERT INTO [Registratie formulier].[PV_Location] " _
& "(PV_Location) VALUES " _
& "('" & hyperlink_pv_var$ & "');"
备注:
- 如果字段、table 或数据库名称包含空格,请括在
[ ]
中
- 此代码假定
hyperlink_pv_var$
始终是一个字符串。