Results 1 to 11 of 11

Thread: [RESOLVED] [Urgent] Problem in linking my CarRegNo to my database

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    365

    Resolved [RESOLVED] [Urgent] Problem in linking my CarRegNo to my database

    The problem arise is in the invoice form where i used this coding to retrieve data from my database. In the coding below, the combo1,text is retrived from an invoice table.

    VB Code:
    1. Private Sub Form_Load()
    2.     Set Inv = New Class3 ' The text field and combo text is link to my invoice database
    3.     Set Text1.DataSource = Inv
    4.     Text1.DataField = "InvoiceID"
    5.     Set Text2.DataSource = Inv
    6.         Text2.DataField = "DateRent"
    7.     Set Text3.DataSource = Inv
    8.     Text3.DataField = "DateReturn"
    9.     Set combo1.DataSource = Inv
    10.     combo1.DataField = "CustID"

    combo1 is the CarRegNO in MS access and is the foreign key in invoice table and also a primary key in car details. The car details in linked 1 - M relations to the invoice table.

    VB Code:
    1. Private Sub Combo1_Click() '<--- this combo1 is open from a car details table
    2. Call connectDB
    3.     If Combo1.Text <> "Select Car Reg No" Then
    4.         sql = "SELECT DISTINCT * FROM CarDetails WHERE CarRegNo='" & Combo1.Text & "'"
    5.         rs.Open sql, cn, adOpenStatic, adLockOptimistic, adCmdText

    The same combo1 text, but they are open in different tables using ADODB connection. How can i form a relationship between them?
    Last edited by macky^^; Feb 10th, 2006 at 12:29 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width