Các Lệnh Thường Gặp Khi Kết Nối Vb

Embed Size (px)

DESCRIPTION

Các Lệnh Thường Gặp Khi Kết Nối Vb

Citation preview

cc lnh thng gp khi kt ni vb:1. gn gi tr:tn i tng=gi trcc lnh thng gp khi kt ni vb:1. gn gi tr:tn i tng=gi trv d: txtkq="phng trnh v nghim"2.hin,n:tn i tng.Visible=Truetn i tng.Visible=Falsev d: che textbox tn txthsctxthsc.visible=False3.khng cho thay i gi tr,cho thay i(m kha):tn i tng.Locked=Truetn i tng.Locked=False4.che m i tng(khng che m):tn i tng.Enabled=Falsetn i tng.Enabled=True5.hin th gi tr thay i bn trong(lm ti):tn i tng.Requery6.Di chuyn:v u: Docmd.GotoRecord,,acFirstv trc: Docmd.GotoRecord,,acPreviousv sau: Docmd.GotoRecord,,acNextv cui: Docmd.GotoRecord,,acLast7.Di chuyn con nhy hoc xc nh ct thao tc(trong tm kim ,sp xp,....):tn i tng.SetForcushocDocmd.GotoControl tn i tng(tn i tng nm trong cp nhy i)8.Thm mu tin:tn i tng.SetForcusDocmd.GotoRecord,,acNewRec9.Lu mu tin hin hnh:Docmd.RunCommand acCmdSaveRecord10.Phc hi(khng lu):SendKeys "{ESC}",True hocIf Me.Dirty=True ThenDocmd.RunCommand acCmdUndoEnd If11.Xa:Docmd.SetWarnings FalseDocmd.RunCommand acCmdDeleteRecordDocmd.SetWarnings True12.Tm mu tin tha iu kin:-tm theo h thngtn i tng.SetForcus 'cho bit ct s tmDocmd.RunCommand acCmdFind-nhp iu kin trc tip:tn i tng.SetForcusDocmd.FindRecord tn i tng ch gi tr tm13.Sp xp mt ct:tn i tng.SetForcustng: Docmd.RunCommand acCmdSortAscendinggim: Docmd.RunCommand acCmdSortDesending14.Lc d liu:Form:Docmd.ApplyFilter,chui iu kinvd: Docmd.ApplyFilter , "mato=" '&klc&'""trong iu kin lc l tn ca textbox m ngi s dng nhp iu kinReport:Me.FilterOn=True 'bt ch lcMe.Filter=chui iu kin15.B lc:Docmd.ShowAllRecord16.Thot khi Access:Docmd.Quit17.Thi hnh SQL Action:Docmd.RunSQL "cu lnh SQL"vd: Docmd.RunSQL "Update chamcong set tiencong=socong*dongiacv;"18.Thi hnh truy vn:Docmd.OpenQuery tn truy vnvd: Docmd.OpenQuery "tblTinhThanh"19.ng mn hnh:Docmd.Close20.Thay i kch thc mn hnh(Form)phng to: Docmd.MaximizeThu nh: Docmd.MinimizePhc hi kch thc ban u: Docmd.Restore

Phng thc OpenForm:Docmd.OpenForm formname[,view][filtername][,wherecondition][,datamode][,windowmode][,openargs]Docmd.OpenForm tn form[,c xem][,b lc][,chui kin][,c cp nht][,c ca s][,openargs]v d: txtkq="phng trnh v nghim"2.hin,n:tn i tng.Visible=Truetn i tng.Visible=Falsev d: che textbox tn txthsctxthsc.visible=False3.khng cho thay i gi tr,cho thay i(m kha):tn i tng.Locked=Truetn i tng.Locked=False4.che m i tng(khng che m):tn i tng.Enabled=Falsetn i tng.Enabled=True5.hin th gi tr thay i bn trong(lm ti):tn i tng.Requery6.Di chuyn:v u: Docmd.GotoRecord,,acFirstv trc: Docmd.GotoRecord,,acPreviousv sau: Docmd.GotoRecord,,acNextv cui: Docmd.GotoRecord,,acLast7.Di chuyn con nhy hoc xc nh ct thao tc(trong tm kim ,sp xp,....):tn i tng.SetForcushocDocmd.GotoControl tn i tng(tn i tng nm trong cp nhy i)8.Thm mu tin:tn i tng.SetForcusDocmd.GotoRecord,,acNewRec9.Lu mu tin hin hnh:Docmd.RunCommand acCmdSaveRecord10.Phc hi(khng lu):SendKeys "{ESC}",True hocIf Me.Dirty=True ThenDocmd.RunCommand acCmdUndoEnd If11.Xa:Docmd.SetWarnings FalseDocmd.RunCommand acCmdDeleteRecordDocmd.SetWarnings True12.Tm mu tin tha iu kin:-tm theo h thngtn i tng.SetForcus 'cho bit ct s tmDocmd.RunCommand acCmdFind-nhp iu kin trc tip:tn i tng.SetForcusDocmd.FindRecord tn i tng ch gi tr tm13.Sp xp mt ct:tn i tng.SetForcustng: Docmd.RunCommand acCmdSortAscendinggim: Docmd.RunCommand acCmdSortDesending14.Lc d liu:Form:Docmd.ApplyFilter,chui iu kinvd: Docmd.ApplyFilter , "mato=" '&klc&'""trong iu kin lc l tn ca textbox m ngi s dng nhp iu kinReport:Me.FilterOn=True 'bt ch lcMe.Filter=chui iu kin15.B lc:Docmd.ShowAllRecord16.Thot khi Access:Docmd.Quit17.Thi hnh SQL Action:Docmd.RunSQL "cu lnh SQL"vd: Docmd.RunSQL "Update chamcong set tiencong=socong*dongiacv;"18.Thi hnh truy vn:Docmd.OpenQuery tn truy vnvd: Docmd.OpenQuery "tblTinhThanh"19.ng mn hnh:Docmd.Close20.Thay i kch thc mn hnh(Form)phng to: Docmd.MaximizeThu nh: Docmd.MinimizePhc hi kch thc ban u: Docmd.Restore

Phng thc OpenForm:Docmd.OpenForm formname[,view][filtername][,wherecondition][,datamode][,windowmode][,openargs]Docmd.OpenForm tn form[,c xem][,b lc][,chui kin][,c cp nht][,c ca s][,openargs]