Rambler's Top100
Форум: MS ACCESSVBVBA MS OfficeMS SQL server
Новые сообщения: 0000

Форум: MS ACCESS

Вопросы связанные с MS ACCESS

Обновить визитку
Участники «Online»
Все участники

 
 

Доброго времени суток, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: DoCmd.OpenForm - ПРЕДЛОЖЕНИЕ WHERE
 
 автор: stix   (01.09.2006 в 00:00)
 
 

Нажав дв.клик по списку - передается выбранный человек из списка и вызывается форма "output" со сведениями о нем. Не могу понять, как форма "output" получает выбранного человека.
Это, явно, передается через stLinkCriteria, Но оно по msgbox-у имеет значение "". Подскажите, как работает.

Private Sub spisok_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "output"
DoCmd.OpenForm stDocName, , , stLinkCriteria
msgBox(stLinkCriteria)

Exit Sub

  Ответить  
 
 автор: ?????????????   (01.09.2006 в 00:00)
 
 

возможна обработка в форме output код в студию

  Ответить  
 
 автор: stix   (01.09.2006 в 00:00)
 
 

Re: возможна обработка в форме output Option Compare Database
Private Sub list_street_Click()
On Error GoTo Err_list_street_Click
Call none обнуление значений
With Form_output
.list_dom.RowSource = ""
.list_dom.RowSource = "select main.id,main.dom from main where main.street_id = " & .list_street.value & " order by main.dom;"
End With
Err_list_street_Click:
End Sub

Private Sub close_input_Click()
On Error GoTo Err_close_input_Click
DoCmd.Close
Exit_close_input_Click:
Exit Sub

Err_close_input_Click:
MsgBox Err.Description
Resume Exit_close_input_Click
End Sub
Private Sub source(obj As Integer)
On Error GoTo Err_sourse
With Form_output
Call none
Dim MyBase As Database
Dim MyRec As Recordset
Dim id_main As Integer

id_main = obj
Set MyBase = CurrentDb()
установка значений района и участка
Set MyRec = MyBase.OpenRecordset("SELECT street.id, main.dom, grp.grp, div.name FROM street INNER JOIN (grp INNER JOIN (div INNER JOIN main ON div.id = main.div_id) ON grp.id = main.grp_id) ON street.id = main.street_id WHERE main.id = " & id_main)
If MyRec.RecordCount <> 0 Then
.list_street.value = MyRec("id")
.list_dom.RowSource = ""
.list_dom.RowSource = "select main.id,main.dom from main where main.street_id = " & MyRec("id") & " order by main.dom;"
.list_dom.value = id_main
.input_div.value = MyRec("name")
.input_grp.value = MyRec("grp")
End If
вывод заначений таблицы t_number
Set MyRec = MyBase.OpenRecordset("SELECT * FROM t_number WHERE t_number.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p21.value = MyRec("seria")
.p22.value = MyRec("invno")
.p23.value = MyRec("etage")
.p24.value = MyRec("dpodezd")
.p25.value = MyRec("stena")
.p26.value = MyRec("perekr")
.p28.value = MyRec("krov")
End If
вывод заначений таблицы t_date
Set MyRec = MyBase.OpenRecordset("SELECT * FROM t_date WHERE t_date.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p31.value = MyRec("godp")
.p32.value = MyRec("godkr")
.p33.value = MyRec("godrk")
.p34.value = MyRec("godpr")
End If
вывод заначений таблицы t_square
Set MyRec = MyBase.OpenRecordset("SELECT * FROM t_square WHERE t_square.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p41.value = MyRec("szas")
.p42.value = MyRec("szhil")
.p43.value = MyRec("snzhil")
.p44.value = MyRec("sobpl")
.p45.value = MyRec("kubat")
.p46.value = MyRec("skrov")
.p47.value = MyRec("sfasad")
.p48.value = MyRec("hpotol")
.p49.value = MyRec("s1et")
.p410.value = MyRec("slet")
If MyRec("zhil1et") Then
.p411.value = "Жилой"
Else
.p411.value = "Не жилой"
End If
.p412.value = MyRec("szhilp")
End If
вывод заначений таблицы residence
Set MyRec = MyBase.OpenRecordset("SELECT * FROM residence WHERE residence.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p51.value = MyRec("kvart")
.p52.value = MyRec("kvprivat")
.p53.value = MyRec("kvmunic")
.p54.value = MyRec("kvsluz")
.p55.value = MyRec("kvarend")
.p56.value = MyRec("kvkomm")
.p57.value = MyRec("komn")
End If
вывод заначений таблицы lodger
Set MyRec = MyBase.OpenRecordset("SELECT * FROM lodger WHERE lodger.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p71.value = MyRec("kpr")
.p72.value = MyRec("kls")
.p73.value = MyRec("kvpr")
End If
вывод заначений таблицы balance
Set MyRec = MyBase.OpenRecordset("SELECT * FROM balance WHERE balance.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p91.value = MyRec("balst")
.p93.value = MyRec("iznos")
.p96.value = MyRec("shzatr")
.p97.value = MyRec("shnorm")
.p98.value = MyRec("norma")
End If
вывод заначений таблицы provision
Set MyRec = MyBase.OpenRecordset("SELECT * FROM provision WHERE provision.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then

If MyRec("hvs") Then
.p101.value = "Есть"
Else
.p101.value = "Нет"
End If
If MyRec("gvs") Then
.p102.value = "Есть"
Else
.p102.value = "Нет"
End If
.p103.value = MyRec("postav")
If MyRec("kanal") Then
.p104.value = "Есть"
Else
.p104.value = "Нет"
End If
.p105.value = MyRec("vdk")
.p106.value = MyRec("vgk")
.p107.value = MyRec("vgv")
.p108.value = MyRec("gaz")
.p109.value = MyRec("musor")
.p1010.value = MyRec("gde_mus")
.p1011.value = MyRec("elpl")
.p1012.value = MyRec("radio")
.p1013.value = MyRec("fire")
.p1014.value = MyRec("postotop")
.p1015.value = MyRec("otopl")
.p1016.value = MyRec("Otoprazv")
End If
вывод заначений таблицы cable
Set MyRec = MyBase.OpenRecordset("SELECT * FROM cable WHERE cable.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p121.value = MyRec("opr")
.p122.value = MyRec("zpr")
.p123.value = MyRec("lamp")
.p124.value = MyRec("elsh")
.p125.value = MyRec("gde_sh")
End If
вывод заначений таблицы territory
Set MyRec = MyBase.OpenRecordset("SELECT * FROM territory WHERE territory.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p131.value = MyRec("uasf")
.p132.value = MyRec("utbp")
.p133.value = MyRec("ugaz")
.p134.value = MyRec("dasf")
.p135.value = MyRec("dtbp")
.p136.value = MyRec("dgaz")
.p137.value = MyRec("cvet")
.p138.value = MyRec("vkdor")
.p139.value = MyRec("spod")
.p1310.value = MyRec("sprpom")
.p1311.value = MyRec("pdvorn")
.p1312.value = MyRec("pubor")
.p1313.value = MyRec("lasf")
.p1314.value = MyRec("ltbp")
.p1315.value = MyRec("lgaz")
.p1316.value = MyRec("zasf")
.p1317.value = MyRec("ztbp")
.p1318.value = MyRec("zgaz")
End If
вывод заначений таблицы personnel
Set MyRec = MyBase.OpenRecordset("SELECT * FROM personnel WHERE personnel.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p141.value = MyRec("dvorn")
.p142.value = MyRec("ubor")
.p143.value = MyRec("muspr")
.p144.value = MyRec("blago")
End If
вывод заначений таблицы equip
Set MyRec = MyBase.OpenRecordset("SELECT * FROM equip WHERE equip.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p151.value = MyRec("dinfo")
.p152.value = MyRec("zhdver")
.p153.value = MyRec("kodzam")
.p154.value = MyRec("kontpl")
.p155.value = MyRec("numkont")
.p156.value = MyRec("sportpl")
.p157.value = MyRec("divan")
.p158.value = MyRec("skam")
.p159.value = MyRec("dustpl")
.p1510.value = MyRec("sushil")
.p1511.value = MyRec("pogreb")
.p1512.value = MyRec("tualet")
End If
вывод заначений таблицы
Set MyRec = MyBase.OpenRecordset("SELECT * FROM lift WHERE lift.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.vk5.Caption = "Лифты*"
.list_lift.RowSource = "SELECT lift.id_lift, lift.id, lift.podezd, lift.lnom, lift.regno, lift.nazn, lift.dveri, lift.gruz, lift.etagn, lift.ostan, lift.kolpr FROM lift where lift.id = " & id_main & " ORDER BY lift.podezd;"
.p111.value = MyRec("podezd")
.p112.value = MyRec("lnom")
.p113.value = MyRec("regno")
.p114.value = MyRec("nazn")
.p115.value = MyRec("dveri")
.p116.value = MyRec("gruz")
.p117.value = MyRec("etagn")
.p118.value = MyRec("ostan")
.p119.value = MyRec("kolpr")
Else
.vk5.Caption = "Лифты"
.list_lift.RowSource = "SELECT lift.id_lift, lift.id, lift.podezd, lift.lnom, lift.regno, lift.nazn, lift.dveri, lift.gruz, lift.etagn, lift.ostan, lift.kolpr FROM lift where lift.id = " & id_main & " ORDER BY lift.podezd;"
End If
End With

Err_sourse:
MsgBox Err.Description
End Sub

Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
source (Form_f1.list_main.value)
Err_Form_Open:
MsgBox Err.Description
MsgBox Err.Source
End Sub
Private Sub list_dom_Click()
On Error GoTo Err_list_dom_Click
source (Form_output.list_dom.value)
Err_list_dom_Click:
MsgBox Err.Description
MsgBox Err.Source
End Sub

Private Sub none()
On Error GoTo Err_none
With Form_output
.input_div.value = ""
.input_grp.value = ""
.p21.value = ""
.p22.value = ""
.p23.value = ""
.p24.value = ""
.p25.value = ""
.p26.value = ""
.p28.value = ""
.p31.value = ""
.p32.value = ""
.p33.value = ""
.p34.value = ""
.p41.value = ""
.p42.value = ""
.p43.value = ""
.p44.value = ""
.p45.value = ""
.p46.value = ""
.p47.value = ""
.p48.value = ""
.p49.value = ""
.p410.value = ""
.p411.value = ""
.p411.value = ""
.p412.value = ""
.p51.value = ""
.p52.value = ""
.p53.value = ""
.p54.value = ""
.p55.value = ""
.p56.value = ""
.p57.value = ""
.p71.value = ""
.p72.value = ""
.p73.value = ""
.p91.value = ""
.p93.value = ""
.p96.value = ""
.p97.value = ""
.p98.value = ""
.p101.value = ""
.p102.value = ""
.p103.value = ""
.p104.value = ""
.p105.value = ""
.p106.value = ""
.p107.value = ""
.p108.value = ""
.p109.value = ""
.p1010.value = ""
.p1011.value = ""
.p1012.value = ""
.p1013.value = ""
.p1014.value = ""
.p1015.value = ""
.p1016.value = ""
.p121.value = ""
.p122.value = ""
.p123.value = ""
.p124.value = ""
.p125.value = ""
.p131.value = ""
.p132.value = ""
.p133.value = ""
.p134.value = ""
.p135.value = ""
.p136.value = ""
.p137.value = ""
.p138.value = ""
.p139.value = ""
.p1310.value = ""
.p1311.value = ""
.p1312.value = ""
.p1313.value = ""
.p1314.value = ""
.p1315.value = ""
.p1316.value = ""
.p1317.value = ""
.p1318.value = ""
.p141.value = ""
.p142.value = ""
.p143.value = ""
.p144.value = ""
.p151.value = ""
.p152.value = ""
.p153.value = ""
.p154.value = ""
.p155.value = ""
.p156.value = ""
.p157.value = ""
.p158.value = ""
.p159.value = ""
.p1510.value = ""
.p1511.value = ""
.p1512.value = ""
.p111.value = ""
.p112.value = ""
.p113.value = ""
.p114.value = ""
.p115.value = ""
.p116.value = ""
.p117.value = ""
.p118.value = ""
.p119.value = ""
End With
Err_none:
End Sub

  Ответить  
 
 автор: stix   (01.09.2006 в 00:00)
 
 

Код модуля формы "output" Option Compare Database
Private Sub list_street_Click()
On Error GoTo Err_list_street_Click
Call none
With Form_output
.list_dom.RowSource = ""
.list_dom.RowSource = "select main.id,main.dom from main where main.street_id = " & .list_street.value & " order by main.dom;"
End With
Err_list_street_Click:
End Sub

Private Sub close_input_Click()
On Error GoTo Err_close_input_Click
DoCmd.Close
Exit_close_input_Click:
Exit Sub

Err_close_input_Click:
MsgBox Err.Description
Resume Exit_close_input_Click
End Sub
Private Sub source(obj As Integer)
On Error GoTo Err_sourse
With Form_output
Call none
Dim MyBase As Database
Dim MyRec As Recordset
Dim id_main As Integer

id_main = obj
Set MyBase = CurrentDb()
установка значений района и участка
Set MyRec = MyBase.OpenRecordset("SELECT street.id, main.dom, grp.grp, div.name FROM street INNER JOIN (grp INNER JOIN (div INNER JOIN main ON div.id = main.div_id) ON grp.id = main.grp_id) ON street.id = main.street_id WHERE main.id = " & id_main)
If MyRec.RecordCount <> 0 Then
.list_street.value = MyRec("id")
.list_dom.RowSource = ""
.list_dom.RowSource = "select main.id,main.dom from main where main.street_id = " & MyRec("id") & " order by main.dom;"
.list_dom.value = id_main
.input_div.value = MyRec("name")
.input_grp.value = MyRec("grp")
End If
вывод заначений таблицы t_number
Set MyRec = MyBase.OpenRecordset("SELECT * FROM t_number WHERE t_number.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p21.value = MyRec("seria")
.p22.value = MyRec("invno")
.p23.value = MyRec("etage")
.p24.value = MyRec("dpodezd")
.p25.value = MyRec("stena")
.p26.value = MyRec("perekr")
.p28.value = MyRec("krov")
End If
вывод заначений таблицы t_date
Set MyRec = MyBase.OpenRecordset("SELECT * FROM t_date WHERE t_date.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p31.value = MyRec("godp")
.p32.value = MyRec("godkr")
.p33.value = MyRec("godrk")
.p34.value = MyRec("godpr")
End If
вывод заначений таблицы t_square
Set MyRec = MyBase.OpenRecordset("SELECT * FROM t_square WHERE t_square.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p41.value = MyRec("szas")
.p42.value = MyRec("szhil")
.p43.value = MyRec("snzhil")
.p44.value = MyRec("sobpl")
.p45.value = MyRec("kubat")
.p46.value = MyRec("skrov")
.p47.value = MyRec("sfasad")
.p48.value = MyRec("hpotol")
.p49.value = MyRec("s1et")
.p410.value = MyRec("slet")
If MyRec("zhil1et") Then
.p411.value = "Жилой"
Else
.p411.value = "Не жилой"
End If
.p412.value = MyRec("szhilp")
End If
вывод заначений таблицы residence
Set MyRec = MyBase.OpenRecordset("SELECT * FROM residence WHERE residence.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p51.value = MyRec("kvart")
.p52.value = MyRec("kvprivat")
.p53.value = MyRec("kvmunic")
.p54.value = MyRec("kvsluz")
.p55.value = MyRec("kvarend")
.p56.value = MyRec("kvkomm")
.p57.value = MyRec("komn")
End If
вывод заначений таблицы lodger
Set MyRec = MyBase.OpenRecordset("SELECT * FROM lodger WHERE lodger.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p71.value = MyRec("kpr")
.p72.value = MyRec("kls")
.p73.value = MyRec("kvpr")
End If
вывод заначений таблицы balance
Set MyRec = MyBase.OpenRecordset("SELECT * FROM balance WHERE balance.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p91.value = MyRec("balst")
.p93.value = MyRec("iznos")
.p96.value = MyRec("shzatr")
.p97.value = MyRec("shnorm")
.p98.value = MyRec("norma")
End If
вывод заначений таблицы provision
Set MyRec = MyBase.OpenRecordset("SELECT * FROM provision WHERE provision.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then

If MyRec("hvs") Then
.p101.value = "Есть"
Else
.p101.value = "Нет"
End If
If MyRec("gvs") Then
.p102.value = "Есть"
Else
.p102.value = "Нет"
End If
.p103.value = MyRec("postav")
If MyRec("kanal") Then
.p104.value = "Есть"
Else
.p104.value = "Нет"
End If
.p105.value = MyRec("vdk")
.p106.value = MyRec("vgk")
.p107.value = MyRec("vgv")
.p108.value = MyRec("gaz")
.p109.value = MyRec("musor")
.p1010.value = MyRec("gde_mus")
.p1011.value = MyRec("elpl")
.p1012.value = MyRec("radio")
.p1013.value = MyRec("fire")
.p1014.value = MyRec("postotop")
.p1015.value = MyRec("otopl")
.p1016.value = MyRec("Otoprazv")
End If
вывод заначений таблицы cable
Set MyRec = MyBase.OpenRecordset("SELECT * FROM cable WHERE cable.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p121.value = MyRec("opr")
.p122.value = MyRec("zpr")
.p123.value = MyRec("lamp")
.p124.value = MyRec("elsh")
.p125.value = MyRec("gde_sh")
End If
вывод заначений таблицы territory
Set MyRec = MyBase.OpenRecordset("SELECT * FROM territory WHERE territory.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p131.value = MyRec("uasf")
.p132.value = MyRec("utbp")
.p133.value = MyRec("ugaz")
.p134.value = MyRec("dasf")
.p135.value = MyRec("dtbp")
.p136.value = MyRec("dgaz")
.p137.value = MyRec("cvet")
.p138.value = MyRec("vkdor")
.p139.value = MyRec("spod")
.p1310.value = MyRec("sprpom")
.p1311.value = MyRec("pdvorn")
.p1312.value = MyRec("pubor")
.p1313.value = MyRec("lasf")
.p1314.value = MyRec("ltbp")
.p1315.value = MyRec("lgaz")
.p1316.value = MyRec("zasf")
.p1317.value = MyRec("ztbp")
.p1318.value = MyRec("zgaz")
End If
вывод заначений таблицы personnel
Set MyRec = MyBase.OpenRecordset("SELECT * FROM personnel WHERE personnel.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p141.value = MyRec("dvorn")
.p142.value = MyRec("ubor")
.p143.value = MyRec("muspr")
.p144.value = MyRec("blago")
End If
вывод заначений таблицы equip
Set MyRec = MyBase.OpenRecordset("SELECT * FROM equip WHERE equip.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.p151.value = MyRec("dinfo")
.p152.value = MyRec("zhdver")
.p153.value = MyRec("kodzam")
.p154.value = MyRec("kontpl")
.p155.value = MyRec("numkont")
.p156.value = MyRec("sportpl")
.p157.value = MyRec("divan")
.p158.value = MyRec("skam")
.p159.value = MyRec("dustpl")
.p1510.value = MyRec("sushil")
.p1511.value = MyRec("pogreb")
.p1512.value = MyRec("tualet")
End If
вывод заначений таблицы
Set MyRec = MyBase.OpenRecordset("SELECT * FROM lift WHERE lift.id = " & id_main & ";")
If MyRec.RecordCount <> 0 Then
.vk5.Caption = "Лифты*"
.list_lift.RowSource = "SELECT lift.id_lift, lift.id, lift.podezd, lift.lnom, lift.regno, lift.nazn, lift.dveri, lift.gruz, lift.etagn, lift.ostan, lift.kolpr FROM lift where lift.id = " & id_main & " ORDER BY lift.podezd;"
.p111.value = MyRec("podezd")
.p112.value = MyRec("lnom")
.p113.value = MyRec("regno")
.p114.value = MyRec("nazn")
.p115.value = MyRec("dveri")
.p116.value = MyRec("gruz")
.p117.value = MyRec("etagn")
.p118.value = MyRec("ostan")
.p119.value = MyRec("kolpr")
Else
.vk5.Caption = "Лифты"
.list_lift.RowSource = "SELECT lift.id_lift, lift.id, lift.podezd, lift.lnom, lift.regno, lift.nazn, lift.dveri, lift.gruz, lift.etagn, lift.ostan, lift.kolpr FROM lift where lift.id = " & id_main & " ORDER BY lift.podezd;"
End If
End With

Err_sourse:
MsgBox Err.Description
End Sub

Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
source (Form_f1.list_main.value)
Err_Form_Open:
MsgBox Err.Description
MsgBox Err.Source
End Sub
Private Sub list_dom_Click()
On Error GoTo Err_list_dom_Click
source (Form_output.list_dom.value)
Err_list_dom_Click:
MsgBox Err.Description
MsgBox Err.Source
End Sub

последняя ф-я - делает просто зануление выводных полей
весь код одного вида типа With Form_output
.input_div.value = ""
поэтому не привожу
Private Sub none()
End Sub

  Ответить  
 
 автор: ?????   (01.09.2006 в 00:00)
 
 

source (Form_f1.list_main.value)

  Ответить  
HiProg.com - Технологии программирования
Rambler's Top100 TopList