|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
How to turn off that annoying "you are about to ..." message in access
Situation: Access database is based on linked tables to another database
problem, anytime I need to insert or update a field in one of my linked tables I get an annoying popup that asks if Im sure I want to "append/insert/delete X records" Problem, if a user says no, then my data is hosed. im generating the sql statements via vba code behind the scenes after users click buttons and so forth. example: Private Sub defaultfulfillment_Click() Dim loadid As String Dim orderno As String Dim productno As String Dim fulfillmentno As Integer Dim con As Object Dim rs As Object Dim fulfillmentcount As Object Dim rs2 As Object Dim strSQL As String loadid = Forms!loadheader!formloadno.Value fulfillmentno = 0 Set con = Application.CurrentProject.Connection strSQL = "SELECT Max([FULFILLMENT_ITEM]) AS maxcount FROM DB2ADMIN_LOAD_FULFILLMENTS" Set fulfillmentcount = CreateObject("ADODB.Recordset") fulfillmentcount.Open strSQL, con, 1 If (fulfillmentcount![maxcount] >= 1) Then fulfillmentno = CLng(fulfillmentcount![maxcount]) End If strSQL = "select [ORDER_NO] from [DB2ADMIN_LOAD_ITEMS] where [LOAD_ID]=" & loadid Set rs = CreateObject("ADODB.Recordset") rs.Open strSQL, con, 1 While (Not (rs.EOF)) Set rs2 = CreateObject("ADODB.Recordset") strSQL = "select [PRODUCT], CLng([CASES_ORDERED]) as CASES from [DB2ADMIN_ORDER_DETAIL] where [ORDER_NUMBER]='" & rs![ORDER_NO] & "'" rs2.Open strSQL, con, 1 While (Not (rs2.EOF)) fulfillmentno = fulfillmentno + 1 strSQL = "insert into [DB2ADMIN_LOAD_FULFILLMENTS] ([FULFILLMENT_ITEM],[LOAD_ID],[ORDER_NO],[PRODUCT],[CASES],[WAREHOUSE]) values (" strSQL = strSQL & fulfillmentno & "," & loadid & ",'" & rs![ORDER_NO] & "','" & rs2![PRODUCT] & "'," & rs2![CASES] & ",'350')" DoCmd.RunSQL strSQL rs2.MoveNext Wend rs.MoveNext Wend Forms!loadheader.Requery Forms!loadheader.Refresh End Sub anytime I use the DoCmd.RunSQL method the computer asks if Im sure I want to insert the records. this particular nested while loop could possibly insert 60 records or more, I sure dont want to depend on a user to click yes 60 times before they can go on to the next thing. what do I need to change |
|
#2
|
|||
|
|||
|
Why don't you just run your insert in code?
con.execute(strSQL)
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > How to turn off that annoying "you are about to ..." message in access |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|