Home > Archive > dBASE Questions and Answers > September 2005 > Search Window









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Search Window
John E Sherrer

2005-08-26, 1:24 pm

Hi Folks
I am a beginner.
I was looking at the SQL Designer trying to figure out how to build a
Customer search window.
I need to search the Customer database by Customer number & Customer name
with a list Box or grid.
If someone could give me the steps to so this, it would be a great help.
John


Roland Wingerter

2005-09-07, 7:23 am

John E Sherrer wrote:
> Hi Folks
> I am a beginner.
> I was looking at the SQL Designer trying to figure out how to build a
> Customer search window.
> I need to search the Customer database by Customer number & Customer
> name with a list Box or grid.
> If someone could give me the steps to so this, it would be a great
> help. John

---------
I know I am a bit late, but ...

I recommend to check out the dBase Knowledgebase and in particular the dBASE
tutorial which can be downloaded from the dBASE web site. Both are an
absolute must for beginners.

Once you have the dbase tutorial installed, try the sample form below. The
code for the search function is in the ENTRYFIELD1_onChange
.

Hope this helps

Roland

// Customer search form using Customer.dbf from the dbase tutorial
** END HEADER -- do not remove this line
//
// Generated on 07.09.2005
//
parameter bModal
local f
f = new CustomerSearchForm()

if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class CustomerSearchForm of FORM
with (this)
height = 16.0
left = 36.7143
top = 4.5909
width = 73.5714
text = "Customer Search"
endwith

this.DBASETUTORIAL1 = new DATABASE()
this.DBASETUTORIAL1.parent = this
with (this.DBASETUTORIAL1)
left = 65.0
top = 14.0
databaseName = "DBASETUTORIAL"
active = true
endwith

this.CUSTOMER1 = new QUERY()
this.CUSTOMER1.parent = this
with (this.CUSTOMER1)
left = 55.0
top = 14.0
database = form.dbasetutorial1
sql = "select * from customer.dbf"
active = true
endwith

with (this.CUSTOMER1.rowset)
indexName = "CUSTOMER ID"
endwith

this.TEXTLABEL1 = new TEXTLABEL(this)
with (this.TEXTLABEL1)
height = 1.0
left = 3.0
top = 0.5
width = 5.0
text = "Find:"
endwith

this.ENTRYFIELD1 = new ENTRYFIELD(this)
with (this.ENTRYFIELD1)
onChange = class::ENTRYFIELD1_O
NCHANGE
height = 1.0
left = 10.0
top = 0.5
width = 26.0
value = ""
endwith

this.COMBOBOX1 = new COMBOBOX(this)
with (this.COMBOBOX1)
onChange = class::COMBOBOX1_ONC
HANGE
height = 1.0
left = 45.0
top = 0.5
width = 19.0
dataSource = 'array {"Customer ID","Last Name"}'
style = 1 // DropDown
endwith

this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.customer1.rowset
rowSelect = true
height = 13.5
left = 2.0
top = 2.0
width = 70.0
endwith

this.TEXTLABEL2 = new TEXTLABEL(this)
with (this.TEXTLABEL2)
height = 1.0
left = 39.0
top = 0.5
width = 6.0
text = "Index:"
endwith

this.rowset = this.customer1.rowset

function COMBOBOX1_onChange
form.rowset.indexname := this.value
return

function ENTRYFIELD1_onChange

if not empty(this.value)
if form.combobox1.value = "Customer ID"
form.rowset.findKey(val(this.value))
else
form.rowset.findKey(this.value)
endif
endif
return

endclass


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com