供应商管理模块开发简要说明18722.docx
供应商管理理模块开开发说明明第一部分 基本知知识一、 程序界面二、 对象属性设设置对象属性名属性值Form11Captiion供应商管理理模块Labell1Captiion供应商编号号Labell2Captiion供应商名称称Labell3Captiion供应商电话话Labell4Captiion供应商地址址Text11Text置空Text22Text置空Text33Text置空Text44Text置空Commaand11Captiion确定Commaand22Captiion取消三、 主要程序代代码 1. 在界面上双双击确定定按钮后后,输入入如下代代码:Privaate Subb Coommaand11_Cllickk()If Teext11.Teext = """ OOr TTextt2.TTextt = "" Or Texxt3.Texxt = """ Orr Teext44.Teext = """ TThenn MMsgBBox "请输输入供应应商完整整信息!", , ""提示""Else MMsgBBox "供应应商信息息已成功功提交!", , ""提交成成功" TTextt1.TTextt = "" TTextt2.TTextt = "" TTextt3.TTextt = "" TTextt4.TTextt = ""End IIfEnd SSub2. 在界面上双双击取消消按钮后后,输入入如下代代码:Privaate Subb Coommaand22_Cllickk() EEndEnd SSub第二部分 数据库库应用一、 在Acceess中中建表二、在控件件面板上上添加AADO 控件1) 选择择ADOO和DaataGGridd 控件件2)在界面面上添加加这两个个控件3) 连接接数据源源4)选择建建立的数数据表4) seet ddataa soourcce ffor DattaGrrid conntrool5) Addd aa reecorrd iintoo a tabbleAdodcc1.RRecoordsset.AdddNewwAdodcc1.RRecoordsset.Fieeldss(“供应商商编号”)=”10001”Adodcc1.UUpdaate6) Deelette tthe currrennt rrecoord froom aa taableeAdodcc1.RRecoordsset.DelleteeAdodcc1.UUpdaate7) Soome commmonn meethoodsAdodcc1.RRecoordsset.MovveFiirsttAdodcc1.RRecoordsset.MovveLaastAdodcc1.RRecoordsset.MovveNeextAdodcc1.RRecoordsset.MovvePrreviiouss8) FiilteerDim sstr as strringgstr = Teext11.TeextAdodcc1.RRecoordsset.Fillterr = "供应应商名称称='"" + Strr + "'""9) MssgBooxMsgBoox “Thee daata hass beeen savved succcesssfuullyy”第三部分 实例1 界面面2 数据据库表3 程序序Privaate Subb cmmdInnquiire_Cliick() ''查询功功能Dim kkey, keeyVaaluee Ass Sttrinng 'kkey表表示查询询的字段段,keeyVaaluee表示查查询的内内容key = Coomboo1.TTexttkeyVaaluee = Texxt2.TexxtIf keey = "出出生年月月日" Theen '字字段为日日期型Adodcc1.RRecoordsset.Fillterr = keyy + "="" + "#"" + keyyVallue + ""#"ElseIIf kkey = ""姓名"" Orr keey = "职职位" Theen ''字段为为字符型型Adodcc1.RRecoordsset.Fillterr = keyy + "="" + "'"" + keyyVallue + ""'"ElseIIf kkey = ""工资"" Orr keey = "编编号" Theen ''字段为为数值型型Adodcc1.RRecoordsset.Fillterr = keyy + "="" + keyyVallueEnd IIfEnd SSub-Privaate Subb Coommaand22_Cllickk() '统统计功能能Sum = 0Adodcc1.RRecoordsset.MovveFiirsttWhilee Noot AAdoddc1.Reccorddsett.EOOFSum = Suum + Addodcc1.RRecoordsset.Fieeldss("工工资").VaalueeAdodcc1.RRecoordsset.MovveNeextWendText11.Teext = SStr(Summ)End SSub4基本方方法(1)查询询Adodcc1.RRecoordsset.Fillterr =表表达式字字符串格式:字段段名 关关系运算算符 查查询值当字段名为为日期型型时,查查询值两两端加“#”符号当字段名为为字符型型时,查查询值两两端加“#”符号当字段名为为数值型型时,查查询值两两端不加加任何符符号如:Dim kkey, keeyVaaluee Ass Sttrinng 'kkey表表示查询询的字段段,keeyVaaluee表示查查询的内内容key = Coomboo1.TTexttkeyVaaluee = Texxt2.TexxtIf keey = "出出生年月月日" Theen '字字段为日日期型Adodcc1.RRecoordsset.Fillterr = keyy + "="" + "#"" + keyyVallue + ""#"ElseIIf kkey = ""姓名"" Orr keey = "职职位" Theen ''字段为为字符型型Adodcc1.RRecoordsset.Fillterr = keyy + "="" + "'"" + keyyVallue + ""'"ElseIIf kkey = ""工资"" Orr keey = "编编号" Theen ''字段为为数值型型Adodcc1.RRecoordsset.Fillterr = keyy + "="" + keyyVallueEnd IIf(2)统计计使用循环语语句,如如:Sum = 0Adodcc1.RRecoordsset.MovveFiirsttWhilee Noot AAdoddc1.Reccorddsett.EOOFSum = Suum + Addodcc1.RRecoordsset.Fieeldss("工工资").VaalueeAdodcc1.RRecoordsset.MovveNeextWendText11.Teext = SStr(Summ)