|
|
First tried: Delete with command below: (Objectives: What I wana achieve is when checkbox is checked Aka ='True', Particular recordset will be cut and paste into another table)
strsql = "INSERT INTO MyTable VALUES ('" &TextBox1 & "'" CurrentDb.Execute strsql ' >>> SQL Statement for inserting is fine MySubform.SetFocus ' >>> Can't Delete after successful insert DoCmd.DoMenuItem acFormBar, acEditMenu, acDelete, , acMenuVer70
Second tried: Undo with command below: (Objectives: Just a simple SelectAll & cancel to UnSelect All function in checkbox thats all)
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
ERROR MSG >> The command or action 'undo' isn't available now
Edison
-- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1
|
|
|
[Quoted Text] > strsql = "INSERT INTO MyTable VALUES ('" &TextBox1 & "'" > SQL Statement for inserting is fine
it is? the syntax i normally see is
strsql = "INSERT INTO MyTable ( fieldname ) VALUES ( '" &TextBox1 & "' )"
> Can't Delete after successful insert > DoCmd.DoMenuItem acFormBar, acEditMenu, acDelete, , acMenuVer70
suggest you execute another SQL statement, as
"DELETE * FROM MyTable WHERE PrimaryKeyField = " _ & Me!PrimaryKeyField
> Second tried: Undo with command below: > (Objectives: Just a simple SelectAll & cancel to UnSelect All function in > checkbox thats all)
not sure what you mean by "UnSelect All function in checkbox". if you just want to uncheck the checkbox control, set it's value to False (or Null), as
Me!CheckboxControlName = False (or replace False with Null)
hth
"edisonl via AccessMonster.com" <u47544[ at ]uwe> wrote in message news:8d72bbf679078[ at ]uwe... > First tried: Delete with command below: > (Objectives: What I wana achieve is when checkbox is checked Aka ='True', > Particular recordset will be cut and paste into another table) > > strsql = "INSERT INTO MyTable VALUES ('" &TextBox1 & "'" > CurrentDb.Execute strsql ' >>> > SQL Statement for inserting is fine > MySubform.SetFocus ' >>> > Can't Delete after successful insert > DoCmd.DoMenuItem acFormBar, acEditMenu, acDelete, , acMenuVer70 > > Second tried: Undo with command below: > (Objectives: Just a simple SelectAll & cancel to UnSelect All function in > checkbox thats all) > > DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70 > > ERROR MSG >> The command or action 'undo' isn't available now > > Edison > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1 >
|
|
Hi tina, tks for replying.. ;)
1. Erm.. Ok The Insert works perfectly as I can view it from destinated table, what you seen here are snapshot of the actual ones.
2. As for the Select All & vice versa Un Selec All it works similarly to Email (Eg: Select All Button then Delete)
3. I did achieve it through using a loop (Eg: For i=0 to MyTable.recordcount-1 MyTable!CheckBox =False docmd.gotorecord,,acNext )
4. I feel they ought to be a better way to achieve using less coding to mitigate overall coding complexity and better debugging.
Edison
tina wrote:
[Quoted Text] >> strsql = "INSERT INTO MyTable VALUES ('" &TextBox1 & "'" >> SQL Statement for inserting is fine > >it is? the syntax i normally see is > >strsql = "INSERT INTO MyTable ( fieldname ) VALUES ( '" &TextBox1 & "' )" > >> Can't Delete after successful insert >> DoCmd.DoMenuItem acFormBar, acEditMenu, acDelete, , acMenuVer70 > >suggest you execute another SQL statement, as > >"DELETE * FROM MyTable WHERE PrimaryKeyField = " _ > & Me!PrimaryKeyField > >> Second tried: Undo with command below: >> (Objectives: Just a simple SelectAll & cancel to UnSelect All function in >> checkbox thats all) > >not sure what you mean by "UnSelect All function in checkbox". if you just >want to uncheck the checkbox control, set it's value to False (or Null), as > > Me!CheckboxControlName = False (or replace False with Null) > >hth > >> First tried: Delete with command below: >> (Objectives: What I wana achieve is when checkbox is checked Aka ='True', >[quoted text clipped - 18 lines] >> >> Edison
-- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1
|
|
|