Table in Dialog

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
HolyAbsolut
Newbie
Posts: 17
Joined: Wed Sep 21, 2011 10:28 am

Table in Dialog

Post by HolyAbsolut » Mon Dec 17, 2012 11:03 am

Hi @ all,

at the moment I trying to integrate Macro Schedular to our access file .
This works already very good and I have started to add more & more functions.

Now I want to create a "Search" Dialog. Below the first attempt.
But I'm not happy with it. It's not so smooth as I wish.

As I'm quite new I hope that a experienced user could give me a suggestion how I can present the results in a better way.

Desirable would be a Table or fix Column & Row

Thank you for your Effort

Best Regards

HolyAbsolut


http://s7.directupload.net/file/d/3107/fjb6azcz_jpg.htm

Code: Select all

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
CapsOff
Dialog>Adressbuch
object Adressbuch: TForm
  Left = 247
  Top = 96
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Suche'
  ClientHeight = 297
  ClientWidth = 524
  Color = 14540253
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesktopCenter
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 96
  TextHeight = 13
  object Treffer: TLabel
    Left = 472
    Top = 33
    Width = 3
    Height = 16
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentFont = False
  end
  object Label1: TLabel
    Left = 20
    Top = 72
    Width = 31
    Height = 13
    Caption = 'Firma'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label2: TLabel
    Left = 120
    Top = 72
    Width = 33
    Height = 13
    Caption = 'Name'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label3: TLabel
    Left = 220
    Top = 72
    Width = 61
    Height = 13
    Caption = 'Nachname'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label4: TLabel
    Left = 318
    Top = 72
    Width = 31
    Height = 13
    Caption = 'eMail'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label5: TLabel
    Left = 418
    Top = 72
    Width = 44
    Height = 13
    Caption = 'Telefon'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Firma1: TLabel
    Left = 20
    Top = 100
    Width = 31
    Height = 13
    Caption = 'Firma1'
    Visible = False
  end
  object Firma2: TLabel
    Left = 20
    Top = 130
    Width = 31
    Height = 13
    Caption = 'Firma2'
    Visible = False
  end
  object Firma3: TLabel
    Left = 20
    Top = 160
    Width = 31
    Height = 13
    Caption = 'Firma3'
    Visible = False
  end
  object Firma4: TLabel
    Left = 20
    Top = 190
    Width = 31
    Height = 13
    Caption = 'Firma4'
    Visible = False
  end
  object Firma5: TLabel
    Left = 20
    Top = 220
    Width = 31
    Height = 13
    Caption = 'Firma5'
    Visible = False
  end
  object Name1: TLabel
    Left = 120
    Top = 100
    Width = 34
    Height = 13
    Caption = 'Name1'
    Visible = False
  end
  object Name2: TLabel
    Left = 120
    Top = 130
    Width = 34
    Height = 13
    Caption = 'Name2'
    Visible = False
  end
  object Name3: TLabel
    Left = 120
    Top = 160
    Width = 34
    Height = 13
    Caption = 'Name3'
    Visible = False
  end
  object Name4: TLabel
    Left = 120
    Top = 190
    Width = 34
    Height = 13
    Caption = 'Name4'
    Visible = False
  end
  object Name5: TLabel
    Left = 120
    Top = 220
    Width = 34
    Height = 13
    Caption = 'Name5'
    Visible = False
  end
  object Nachname1: TLabel
    Left = 220
    Top = 100
    Width = 58
    Height = 13
    Caption = 'Nachname1'
    Visible = False
  end
  object Nachname2: TLabel
    Left = 220
    Top = 130
    Width = 58
    Height = 13
    Caption = 'Nachname2'
    Visible = False
  end
  object Nachname3: TLabel
    Left = 220
    Top = 160
    Width = 58
    Height = 13
    Caption = 'Nachname3'
    Visible = False
  end
  object Nachname4: TLabel
    Left = 220
    Top = 190
    Width = 58
    Height = 13
    Caption = 'Nachname4'
    Visible = False
  end
  object Nachname5: TLabel
    Left = 220
    Top = 220
    Width = 58
    Height = 13
    Caption = 'Nachname5'
    Visible = False
  end
  object eMail1: TLabel
    Left = 318
    Top = 100
    Width = 31
    Height = 13
    Caption = 'eMail1'
    Visible = False
  end
  object eMail2: TLabel
    Left = 318
    Top = 130
    Width = 31
    Height = 13
    Caption = 'eMail2'
    Visible = False
  end
  object eMail3: TLabel
    Left = 318
    Top = 160
    Width = 31
    Height = 13
    Caption = 'eMail3'
    Visible = False
  end
  object eMail4: TLabel
    Left = 318
    Top = 190
    Width = 31
    Height = 13
    Caption = 'eMail4'
    Visible = False
  end
  object eMail5: TLabel
    Left = 318
    Top = 220
    Width = 31
    Height = 13
    Caption = 'eMail5'
    Visible = False
  end
  object Telefon1: TLabel
    Left = 418
    Top = 100
    Width = 42
    Height = 13
    Caption = 'Telefon1'
    Visible = False
  end
  object Telefon2: TLabel
    Left = 418
    Top = 130
    Width = 42
    Height = 13
    Caption = 'Telefon2'
    Visible = False
  end
  object Telefon3: TLabel
    Left = 418
    Top = 160
    Width = 42
    Height = 13
    Caption = 'Telefon3'
    Visible = False
  end
  object Telefon4: TLabel
    Left = 418
    Top = 190
    Width = 42
    Height = 13
    Caption = 'Telefon4'
    Visible = False
  end
  object Telefon5: TLabel
    Left = 418
    Top = 220
    Width = 42
    Height = 13
    Caption = 'Telefon5'
    Visible = False
  end
  object Label6: TLabel
    Left = 432
    Top = 35
    Width = 31
    Height = 13
    Caption = 'Treffer'
  end
  object FA: TEdit
    Left = 20
    Top = 35
    Width = 121
    Height = 21
    TabOrder = 0
  end
  object FN: TEdit
    Left = 150
    Top = 35
    Width = 121
    Height = 21
    TabOrder = 1
  end
  object LN: TEdit
    Left = 280
    Top = 35
    Width = 121
    Height = 21
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 424
    Top = 248
    Width = 75
    Height = 25
    Caption = 'Exit'
    ModalResult = 99
    TabOrder = 3
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Combo1: tMSComboBox
    Left = 20
    Top = 10
    Width = 121
    Height = 21
    TabOrder = 5
    Text = 'Firma'
    Items.Strings = (
      'Firma'
      'Name'
      'Nachname'
      'Ort'
      'Land')
    ListText = 'Firma'#13#10'Name'#13#10'Nachname'#13#10'Ort'#13#10'Land'#13#10
  end
  object Combo2: tMSComboBox
    Left = 150
    Top = 10
    Width = 121
    Height = 21
    TabOrder = 6
    Text = 'Name'
    Items.Strings = (
      'Firma'
      'Name'
      'Nachname'
      'Ort'
      'Land')
    ListText = 'Firma'#13#10'Name'#13#10'Nachname'#13#10'Ort'#13#10'Land'#13#10
  end
  object Combo3: tMSComboBox
    Left = 280
    Top = 10
    Width = 121
    Height = 21
    TabOrder = 7
    Text = 'Nachname'
    Items.Strings = (
      'Firma'
      'Name'
      'Nachname'
      'Ort'
      'Land')
    ListText = 'Firma'#13#10'Name'#13#10'Nachname'#13#10'Ort'#13#10'Land'#13#10
  end
  object Erfassen: tMSButton
    Left = 19
    Top = 248
    Width = 75
    Height = 25
    Caption = 'Erfassen'
    ModalResult = 98
    TabOrder = 4
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Adressbuch
Let>Prozent=%

IfFileExists>C:\Transfer\AdressTransfer.txt
MDL>Achtung Datei vorhanden. Wrd nun gelöscht.
DeleteFile>C:\Transfer\AdressTransfer.txt
Endif



Let>connstr=Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\Dokumente und Einstellungen\mnbraun\Desktop\SQL Test\TestDatabase2.accdb;Uid=Admin;Pwd=;
DBConnect>connstr,dbH
AddDialogHandler>Adressbuch,FA,OnChange,Suche
AddDialogHandler>Adressbuch,FN,OnChange,Suche
AddDialogHandler>Adressbuch,LN,OnChange,Suche


AddDialogHandler>Adressbuch,Firma1,OnDblClick,Pos1
AddDialogHandler>Adressbuch,Name1,OnDblClick,Pos1
AddDialogHandler>Adressbuch,Nachname1,OnDblClick,Pos1
AddDialogHandler>Adressbuch,eMail1,OnDblClick,Pos1
AddDialogHandler>Adressbuch,Telefon1,OnDblClick,Pos1

AddDialogHandler>Adressbuch,Firma2,OnDblClick,Pos2
AddDialogHandler>Adressbuch,Name2,OnDblClick,Pos2
AddDialogHandler>Adressbuch,Nachname2,OnDblClick,Pos2
AddDialogHandler>Adressbuch,eMail2,OnDblClick,Pos2
AddDialogHandler>Adressbuch,Telefon2,OnDblClick,Pos2

AddDialogHandler>Adressbuch,Firma3,OnDblClick,Pos3
AddDialogHandler>Adressbuch,Name3,OnDblClick,Pos3
AddDialogHandler>Adressbuch,Nachname3,OnDblClick,Pos3
AddDialogHandler>Adressbuch,eMail3,OnDblClick,Pos3
AddDialogHandler>Adressbuch,Telefon3,OnDblClick,Pos3

AddDialogHandler>Adressbuch,Firma4,OnDblClick,Pos4
AddDialogHandler>Adressbuch,Name4,OnDblClick,Pos4
AddDialogHandler>Adressbuch,Nachname4,OnDblClick,Pos4
AddDialogHandler>Adressbuch,eMail4,OnDblClick,Pos4
AddDialogHandler>Adressbuch,Telefon4,OnDblClick,Pos4

AddDialogHandler>Adressbuch,Firma5,OnDblClick,Pos5
AddDialogHandler>Adressbuch,Name5,OnDblClick,Pos5
AddDialogHandler>Adressbuch,Nachname5,OnDblClick,Pos5
AddDialogHandler>Adressbuch,eMail5,OnDblClick,Pos5
AddDialogHandler>Adressbuch,Telefon5,OnDblClick,Pos5




Show>Adressbuch,R

SRT>Suche
Let>rsCustomers_1_1=0
Let>rsCustomers_2_1=0
Let>rsCustomers_3_1=0
Let>rsCustomers_4_1=0
Let>rsCustomers_5_1=0

GetDialogProperty>Adressbuch,FA,Text,Firma
GetDialogProperty>Adressbuch,FN,Text,Vorname
GetDialogProperty>Adressbuch,LN,Text,Nachnahme
GetDialogProperty>Adressbuch,Combo1,Text,Field1
GetDialogProperty>Adressbuch,Combo2,Text,Field2
GetDialogProperty>Adressbuch,Combo3,Text,Field3



If>Firma<Let>Firma=WHERE %Field1% LIKE '%Firma%%Prozent%'
Endif
If>Vorname<Let>Vorname=AND %Field2% LIKE'%Vorname%%Prozent%'
Endif
If>Nachnahme<Let>Nachnahme=AND %Field3% LIKE'%Nachnahme%%Prozent%'
Endif
Let>Search=%Firma% %Vorname% %Nachnahme%

Let>SQL=Select * from [Address]  %Search%
DBQuery>dbH,SQL,rsCustomers,numRecs,numFields,0
SetDialogProperty>Adressbuch,Treffer,Caption,%numRecs%

//1
If>%rsCustomers_1_1%<0>Adressbuch,Firma1,Visible,True
SetDialogProperty>Adressbuch,Name1,Visible,True
SetDialogProperty>Adressbuch,Nachname1,Visible,True
SetDialogProperty>Adressbuch,eMail1,Visible,True
SetDialogProperty>Adressbuch,Telefon1,Visible,True

SetDialogProperty>Adressbuch,Firma1,Caption,%rsCustomers_1_5%
SetDialogProperty>Adressbuch,Name1,Caption,%rsCustomers_1_3%
SetDialogProperty>Adressbuch,Nachname1,Caption,%rsCustomers_1_4%
SetDialogProperty>Adressbuch,eMail1,Caption,%rsCustomers_1_6%
SetDialogProperty>Adressbuch,Telefon1,Caption,%rsCustomers_1_7%

Else
SetDialogProperty>Adressbuch,Firma1,Visible,False
SetDialogProperty>Adressbuch,Name1,Visible,False
SetDialogProperty>Adressbuch,Nachname1,Visible,False
SetDialogProperty>Adressbuch,eMail1,Visible,False
SetDialogProperty>Adressbuch,Telefon1,Visible,False
Endif

//2
If>%rsCustomers_2_1%<0>Adressbuch,Firma2,Visible,True
SetDialogProperty>Adressbuch,Name2,Visible,True
SetDialogProperty>Adressbuch,Nachname2,Visible,True
SetDialogProperty>Adressbuch,eMail2,Visible,True
SetDialogProperty>Adressbuch,Telefon2,Visible,True

SetDialogProperty>Adressbuch,Firma2,Caption,%rsCustomers_2_5%
SetDialogProperty>Adressbuch,Name2,Caption,%rsCustomers_2_3%
SetDialogProperty>Adressbuch,Nachname2,Caption,%rsCustomers_2_4%
SetDialogProperty>Adressbuch,eMail2,Caption,%rsCustomers_2_6%
SetDialogProperty>Adressbuch,Telefon2,Caption,%rsCustomers_2_7%

Else
SetDialogProperty>Adressbuch,Firma2,Visible,False
SetDialogProperty>Adressbuch,Name2,Visible,False
SetDialogProperty>Adressbuch,Nachname2,Visible,False
SetDialogProperty>Adressbuch,eMail2,Visible,False
SetDialogProperty>Adressbuch,Telefon2,Visible,False
Endif

//3
If>%rsCustomers_3_1%<0>Adressbuch,Firma3,Visible,True
SetDialogProperty>Adressbuch,Name3,Visible,True
SetDialogProperty>Adressbuch,Nachname3,Visible,True
SetDialogProperty>Adressbuch,eMail3,Visible,True
SetDialogProperty>Adressbuch,Telefon3,Visible,True

SetDialogProperty>Adressbuch,Firma3,Caption,%rsCustomers_3_5%
SetDialogProperty>Adressbuch,Name3,Caption,%rsCustomers_3_3%
SetDialogProperty>Adressbuch,Nachname3,Caption,%rsCustomers_3_4%
SetDialogProperty>Adressbuch,eMail3,Caption,%rsCustomers_3_6%
SetDialogProperty>Adressbuch,Telefon3,Caption,%rsCustomers_3_7%

Else
SetDialogProperty>Adressbuch,Firma3,Visible,False
SetDialogProperty>Adressbuch,Name3,Visible,False
SetDialogProperty>Adressbuch,Nachname3,Visible,False
SetDialogProperty>Adressbuch,eMail3,Visible,False
SetDialogProperty>Adressbuch,Telefon3,Visible,False
Endif

//4
If>%rsCustomers_4_1%<0>Adressbuch,Firma4,Visible,True
SetDialogProperty>Adressbuch,Name4,Visible,True
SetDialogProperty>Adressbuch,Nachname4,Visible,True
SetDialogProperty>Adressbuch,eMail4,Visible,True
SetDialogProperty>Adressbuch,Telefon4,Visible,True

SetDialogProperty>Adressbuch,Firma4,Caption,%rsCustomers_4_5%
SetDialogProperty>Adressbuch,Name4,Caption,%rsCustomers_4_3%
SetDialogProperty>Adressbuch,Nachname4,Caption,%rsCustomers_4_4%
SetDialogProperty>Adressbuch,eMail4,Caption,%rsCustomers_4_6%
SetDialogProperty>Adressbuch,Telefon4,Caption,%rsCustomers_4_7%

Else
SetDialogProperty>Adressbuch,Firma4,Visible,False
SetDialogProperty>Adressbuch,Name4,Visible,False
SetDialogProperty>Adressbuch,Nachname4,Visible,False
SetDialogProperty>Adressbuch,eMail4,Visible,False
SetDialogProperty>Adressbuch,Telefon4,Visible,False
Endif

//5
If>%rsCustomers_5_1%<0>Adressbuch,Firma5,Visible,True
SetDialogProperty>Adressbuch,Name5,Visible,True
SetDialogProperty>Adressbuch,Nachname5,Visible,True
SetDialogProperty>Adressbuch,eMail5,Visible,True
SetDialogProperty>Adressbuch,Telefon5,Visible,True

SetDialogProperty>Adressbuch,Firma5,Caption,%rsCustomers_5_5%
SetDialogProperty>Adressbuch,Name5,Caption,%rsCustomers_5_3%
SetDialogProperty>Adressbuch,Nachname5,Caption,%rsCustomers_5_4%
SetDialogProperty>Adressbuch,eMail5,Caption,%rsCustomers_5_6%
SetDialogProperty>Adressbuch,Telefon5,Caption,%rsCustomers_5_7%

Else
SetDialogProperty>Adressbuch,Firma5,Visible,False
SetDialogProperty>Adressbuch,Name5,Visible,False
SetDialogProperty>Adressbuch,Nachname5,Visible,False
SetDialogProperty>Adressbuch,eMail5,Visible,False
SetDialogProperty>Adressbuch,Telefon5,Visible,False
Endif

END>Suche

SRT>Pos1
  CloseDialog>Adressbuch
  WriteLn>C:\Transfer\AdressTransfer.txt,nWLNRes,%rsCustomers_1_1%;%rsCustomers_1_5%;%rsCustomers_1_9%;%rsCustomers_1_10%;%rsCustomers_1_11%;%rsCustomers_1_12%

END>Pos1

SRT>Pos2
  MDL>rsCustomers_2_1
END>Pos2

SRT>Pos3
  MDL>rsCustomers_3_1
END>Pos3

SRT>Pos4
  MDL>rsCustomers_4_1
END>Pos4

SRT>Pos5
  MDL>rsCustomers_5_1
END>Pos5




DBClose>dbH

IF>R=98
Macro>C:\Users\mnbraun\Documents\Macro Scheduler 13\Adressbuch Erfassung.scp
Endif




User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Dec 17, 2012 2:23 pm


HolyAbsolut
Newbie
Posts: 17
Joined: Wed Sep 21, 2011 10:28 am

Post by HolyAbsolut » Tue Dec 18, 2012 8:48 am

Hi,

Thanks for your response. From the first view it look exactly like that I want.

Unfortunately I never have worked before with HTA. I try to learn now the essential parts (Thanks for the Link)

So I will need some time to check if I can modify it to my purpose.

Thanks and best regards. I will keep you up to date.

HolyAbsolut

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts