Verify This

dongodu

Registered User.
Local time
Today, 15:49
Joined
Feb 21, 2012
Messages
13
Kindly Verify This Query
"rs.Open "select customer.cusno,customer.fullname,customer.idcn,customer.mobie,customer.reg,customer.dateis,customer.email,sales.pron,sales.blono,sales.lano,sales.sql from customer,sales where customer.idcn = '" & txtCusC.Text & "'", con, 1, 3"
 
Sure if your goal is to open a Carthasian product but i suspect that you need an INNER JOIN on the 2 tables.

select customer.cusno,customer.fullname,customer.idcn,cus tomer.mobie,customer.reg,customer.dateis,customer. email,sales.pron,sales.blono,sales.lano,sales.sql
from customer INNER JOIN sales ON customer.? = sales.? where customer.idcn = '" & txtCusC.Text & "'"

JR
 
rs.Open "select customer.cusno,customer.fullname,customer.idcn,customer.mobie,customer.reg,customer.dateis,customer.email,sales.pron,sales.blono,sales.lano,sales.sql from customer inner join sales on customer.idcn = sales.idcn where customer.idcn = '" & txtCusC.Text & "'", con, 1, 3

Same Error as before
 
Same Error as before

What error ???

customer.idcn = '" & txtCusC.Text & "'"

Why .Text property? you can only use this property IF txtCusC HAS focus when the code runs.

Try and build the SQL-string first to see if it generates what you expect.

Code:
Dim strSQL As String
strSQL = " select customer.cusno,customer.fullname,customer.idcn,cus tomer.mobie,customer.reg,customer.dateis,customer. email,sales.pron,sales.blono,sales.lano,sales.sql " & _
         " from customer inner join sales on customer.idcn = sales.idcn " & _
         " where customer.idcn = '" & txtCusC & "'"
[B]Debug.Print strSQL[/B]  ' check sql string in immediate window
rs.Open strSQL, con, 1, 3

also to you really have a field in the sales table called sql??

JR
 
********
Code
********
Private Sub cmdPrint_Click()
Set obj = New PrinterControl
obj.ChngOrientationPortrait
Call ConnectMe
rs.Open "select customer.cusno,customer.fullname,customer.idcn,customer.mobie,customer.reg,customer.dateis,customer.email,sales.pron,sales.blono,sales.lano,sales.sql from customer inner join sales on customer.idcn = sales.idcn where customer.idcn = '" & txtCusC.Text & "'", con, 1, 3

If rs.RecordCount = 0 Then
MsgBox "No record found on query.", vbCritical, "Medrar"

Else
Set SpCustomer.DataSource = rs

If IsNull(rs.Fields("CustomerPicture").Value) = False Then
ReDim bData(rs.Fields("CustomerPicture").ActualSize)
bData = rs.Fields("CustomerPicture").Value
szfile = App.Path & "\tempPic.tmp"
Open szfile For Binary Access Write As #1
Put #1, , bData
Close #1
Set SpCustomer.Sections("Section1").Controls("Img").Picture = LoadPicture(szfile)
End If
SpCustomer.Show
End If

Set rs = Nothing
End Sub
 

Attachments

  • New Picture (5).JPG
    New Picture (5).JPG
    11.5 KB · Views: 86

Users who are viewing this thread

Back
Top Bottom