Babycat
Member
- Local time
 - Today, 10:34
 
- Joined
 - Mar 31, 2020
 
- Messages
 - 291
 
Hi Everyone
I have a continuous subform (call it subform B) bound to table TBLTEMPNAME. There is a button on subform A what is to insert new record to TBLTEMPNAME therefore to subform B.
However, before running InsertSQL I normally have to remove the recordsource of subform B to NONE , if not it will introduce an error something likely exclusive open... I think it becauses the subform B is holding table TBLTEMPNAME so it is not allow to insert...
Thus after inserting, I will set recordsource again such following code
	
	
	
		
The side effect is subform flickering because of it's recordsource changed.
Is there anyway to implement it better?
Thank you!
 I have a continuous subform (call it subform B) bound to table TBLTEMPNAME. There is a button on subform A what is to insert new record to TBLTEMPNAME therefore to subform B.
However, before running InsertSQL I normally have to remove the recordsource of subform B to NONE , if not it will introduce an error something likely exclusive open... I think it becauses the subform B is holding table TBLTEMPNAME so it is not allow to insert...
Thus after inserting, I will set recordsource again such following code
		Code:
	
	
	SQL = "SELECT  TBLTEMPNAME .* FROM  TBLTEMPNAME  ORDER BY TempPName ASC;"
    InsertSQL = "INSERT INTO  TBLTEMPNAME "  _
                & " (ProductID, TempCode, TempPName) VALUES " _
                & " (" & Txt_ID & ", '" & Txt_Qinfo_Code & "', '" & Txt_Qinfo_Pname & "');"
            
    Forms!MainForm!SubFrmName.Form.RecordSource = ""  'Set to NONE
        DoCmd.SetWarnings False
        DoCmd.RunSQL InsertSQL
        DoCmd.SetWarnings True
    Forms!MainForm!SubFrmName.Form.RecordSource = SQL ' Set recordsource again
	The side effect is subform flickering because of it's recordsource changed.
Is there anyway to implement it better?
Thank you!
			
				Last edited: