我的def visibleLis = $("div.childSelectInIndex ul.oldSelectIndex li.targetChildAgeForm")
.findAll { it.displayed }
功能出现问题。程序应询问用户是否要覆盖表中已有的一条记录。所以我认为以下代码会这样做:
UPDATE
代码运行但它没有覆盖价格......
答案 0 :(得分:0)
请尝试以下代码:
Dim strSQL As String
Dim Box As String
'Declare variables for your controls here so that you can check what value it returns in debug mode
Dim EventName As String = Me!EventName
Dim Price As String = Me!Price
Dim Date1 As String = Format(CDate(Me!Date1), "\#yyyy-mm-dd\#")
If DCount("*", "tblEvents", "Event = '" & EventName & "' AND Date1= " & Date1) > 0 Then
Box = MsgBox("There is already a price for the event on the selected date. Do you want to overwrite the price?", vbYesNo)
If Box = vbNo Then
Cancel = True
Else
strSQL = "UPDATE tblEvents SET Price = '" & Price & "' WHERE Event = '" & EventName & "' AND Date1 = " & Date1
'Your SQL execute code here
End If
Else
'Your SQL execute code here for Save
End If
End Sub
现在您获得了Price,EventName和Date1的值,尝试在访问编辑器中执行更新查询,以测试从代码中获取的值是否真的有用。
UPDATE tblEvents SET Price = '123' WHERE Event = 'party' AND Date1 ='2016/09/23'