Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBGrid Newbe, please help

Status
Not open for further replies.

quaked2023

Technical User
Joined
Jan 22, 2004
Messages
105
Location
MX
Hi!

I'm a newbe using the DBGrid control and i need help with it... the thing is that i want to display a payment report for each client that i have on my master database, i have two tables, the one with all the information of the client (Client Number, Name, Lastname, Address, Phone.. etc...) and the other has the information on all the payments of all clients, it has the following records: Client Number, Date, Payment.

Now i've done a module where i can search for a client in the client database using the data control, now i want to display the payment report for that client only the problem is that i don't know how to do it, can you help me plese... by the way i don't know how to use SQL... thanks in advance

-The Only Privacy Left Is The Inside Of Your Head!- QUAKED2023
 
Hi quaked2023

Connect DBGrid DataSource and DataMember with Table 2 (ADODC1).
Connect DataCombo Control RowSurce, RowMember with Table 1 and BoundColumn with Client Name.
In DataCombo you choose a name and you write:

Private Sub Command1_Click ()

ADODC1. Filter = " Client Number = ' " & DataCombo1. Text & "'"

End Sub

In DBGrid will seem all records for this purpose client.

Good luck

Miho
 
Hey mi1306, sorry but i don't understand your code. I don't have a DataCombo in my program i have a Data Control... I have 2 Data controls one connected to the clients table and the other connected with the payment table...

What i want to do is to type the name or the client number in a textbox and when i press enter i want it to display the payment report for that particular client in the DBGrid... Hope you can help me... and thanks!

-The Only Privacy Left Is The Inside Of Your Head!- QUAKED2023
 
Well,

type the name in a textbox and when i press enter


Private Sub Command1_Click ()

DAO1.Filter = "ClientName = '" & Text1.Text & "'"

End Sub
 
quaked2023

Excuse me.
Has overlooked to tell that DataGrid does not work with Data control, it is necessary to work with Microsoft ADO Data Control.
So write that code:

Private Sub Command1_Click ()

ADODC1.Filter = "Name = '" & Text1.Text & "'" ' observe precisely intervals in '" & Text1.Text & "'"

End Sub

Miho
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top