Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 131,345 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,651 people online right now. Registration is fast and FREE... Join Now!




Accessing a Database(VB)

 
Reply to this topicStart new topic

Accessing a Database(VB), Displaying individual details

shananne81
post 25 Feb, 2008 - 09:02 AM
Post #1


New D.I.C Head

*
Joined: 15 Feb, 2008
Posts: 8


My Contributions


I managed to link my database to VB..its functioning ok..i also created buttons to add,delete or change, find data....etc ,my problem is i now want to display each customer details..from other tables(i have customer, account and transaction tables)so far its only the customer table which is being on display. How do i link the other tables to my visual basic project?
What iam saying is if i want certain information from say accounts or transaction tables to be on the form when called....e.g customer balance,transaction dates..etc...how do i go about it?
Thanks.


vb

Private Sub Command1_Click()
current_command = "add"
Data1.Recordset.AddNew
End Sub
Private Sub Command2_Click()
current_command = "delete"
End Sub
Private Sub Command3_Click()
current_command = "change"
Data1.Recordset.Edit
End Sub
Private Sub Command4_Click()
On Error GoTo command4_Click_Error
If current_command = "add" Then
Data1.Recordset.Update
End If
If cuurent_command = "delete" Then
Data1.Recordset.Delete
Data1.Recordset.MoveNext
End If
If current_command = "change" Then
Data1.Recordset.Update
End If
command4_Click_OK:
Exit Sub
command4_Click_Error:
x$ = "Error " & Err & " " & Error(Err)
MsgBox x$, 48, "Attempting to " & current_command
Resume command4_Click_OK
End Sub
Private Sub Command5_Click()
Data1.UpdateControls
End Sub

Private Sub Command6_Click()
On Error GoTo command6_Error
x = InputBox("Input first few characters of Customer Surname ", "Find on Surname")
Data1.Recordset.FindFirst "surname like " & "'" & x & "*" & "'"
command6_OK:
Exit Sub
command6_Error:
y = "Error " & Err & " " & Error(Err)
MsgBox y, 48, "Find on Surname"
Resume command6_OK
End Sub

*edit: Please use code tags in the future, thanks! code.gif

This post has been edited by Martyr2: 25 Feb, 2008 - 10:07 AM
User is offlineProfile CardPM

Go to the top of the page


shananne81
post 25 Feb, 2008 - 10:25 AM
Post #2


New D.I.C Head

*
Joined: 15 Feb, 2008
Posts: 8


My Contributions


QUOTE(shananne81 @ 25 Feb, 2008 - 10:02 AM) *

I managed to link my database to VB..its functioning ok..i also created buttons to add,delete or change, find data....etc ,my problem is i now want to display each customer details..from other tables(i have customer, account and transaction tables)so far its only the customer table which is being on display. How do i link the other tables to my visual basic project?
What iam saying is if i want certain information from say accounts or transaction tables to be on the form when called....e.g customer balance,transaction dates..etc...how do i go about it?
Thanks.


vb

Private Sub Command1_Click()
current_command = "add"
Data1.Recordset.AddNew
End Sub
Private Sub Command2_Click()
current_command = "delete"
End Sub
Private Sub Command3_Click()
current_command = "change"
Data1.Recordset.Edit
End Sub
Private Sub Command4_Click()
On Error GoTo command4_Click_Error
If current_command = "add" Then
Data1.Recordset.Update
End If
If cuurent_command = "delete" Then
Data1.Recordset.Delete
Data1.Recordset.MoveNext
End If
If current_command = "change" Then
Data1.Recordset.Update
End If
command4_Click_OK:
Exit Sub
command4_Click_Error:
x$ = "Error " & Err & " " & Error(Err)
MsgBox x$, 48, "Attempting to " & current_command
Resume command4_Click_OK
End Sub
Private Sub Command5_Click()
Data1.UpdateControls
End Sub

Private Sub Command6_Click()
On Error GoTo command6_Error
x = InputBox("Input first few characters of Customer Surname ", "Find on Surname")
Data1.Recordset.FindFirst "surname like " & "'" & x & "*" & "'"
command6_OK:
Exit Sub
command6_Error:
y = "Error " & Err & " " & Error(Err)
MsgBox y, 48, "Find on Surname"
Resume command6_OK
End Sub

*edit: Please use code tags in the future, thanks! code.gif



Thanks..for pointing that out
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/19/08 04:10PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month