Option Compare Database
'Added the option explicit to verify your variables
Option Explicit
Private Sub Button_Click()
'ERROR HANDLING
On Error GoTo Button_Click_Err_Handler
Dim rs As DAO.Recordset
'Is your TicketNumber column a Text data type? Me.List1.Column(0) should return a variant value, so assuming
'your TicketNumber column is of a number type as the name implies, I think you could just use:
'Set rs = CurrentDb.OpenRecordset("SELECT * FROM tbl_name WHERE TicketNumber = " & Me.list1.Column(0))
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tbl_name WHERE TicketNumber = '" & Me.list1.Column(0) & "'")
'You should always check for BOF and EOF if you're checking if there is no record.
If rs.BOF And rs.EOF Then
MsgBox "You have not selected a record, nothing to save!", vbInformation
'Exiting here, instead of wrapping the entire sub in the if... ...end if statement. You could also just use "Exit Sub", but I added
'the exit and error handling to make it a little more graceful.
GoTo Button_Click_Exit
End If
'I wrapped the rs edits in a with statement and used the direct column name operator ! instead of the collection searching rs() feature.
'For illustration, I wrapped a few of the references in the Nz() function. If none of the fields are ever null, bravo to you for excellent
'database design and database users discipline, but I almost always have a couple columns where nulls are allowed.
With rs
.Edit
'Top Categories
!Business = Me.Text5
!Status = Me.Text8
!MailDate = Me.Text10
'Complaint Detail Section
!Type = Me.Text19
!Sub = Me.Text21
!c = Me.Text23
'Complaint Coding Section
!touch2 = Me.Combo29
!touch1 = Me.Combo33
!Cause2 = Me.Combo31
!cause1 = Me.Combo35
'CS Account Details Section
!Account = Me.Text39
!Feed = Me.Combo41
'Logged Audit User
!LoggedUser = Me.Text43
!DateTimeLogged = Me.Text49
.Update
End With
'EXIT PROCEDURE
Button_Click_Exit:
On Error Resume Next
Exit Sub
'ERROR HANDLING
Button_Click_Err_Handler:
MsgBox Err.Number & Err.Description, vbOKOnly + vbCritical, "Error"
Resume Button_Click_Exit
End Sub
这是我的程序,导航到“https://console.api.ai/api-client/#/login”。
我尝试使用.SetAttribute将“kimyong95@gmail.com”填入网站的电子邮件文本框中,但它不起作用。
任何人都知道如何解决这个问题?
谢谢!
答案 0 :(得分:0)
在提供的示例代码中,您尝试通过element属性修改元素属性。元素属性不能用于修改元素属性:What is the difference between properties and attributes in HTML?
以下示例代码演示了如何使用Value
属性设置输入字段值:
DOMInputElement username = (DOMInputElement)document.GetElementById("username");
username.Value = "kimyong95@gmail.com";
以下链接的示例演示了如何使用各种表单字段: https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110038-setting-input-field-value-working-with-form