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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql statement I guess is not correct

Status
Not open for further replies.

xerife007

Technical User
May 7, 2002
40
PT
Hi forum,
I have this code, but don't appear nothing in my form.maskedbox :
My sql statement is:

adoPedAvaliaRs.Open _
"SELECT PK_Processo,StatPedAval,Dt_recep_ped,Dt_envio_ped,ObsPedAvalFROM T_Dts_Pedido_Avalia Where PK_Processo='frmProcesso1.txtfields(0)'", m_oConn, adOpenKeyset, adLockReadOnly

is correct??? I guess not!

Set frmProcesso1.MaskEdBox1(4).DataSource = adoPedAvaliaRs
frmProcesso1.MaskEdBox1(4).DataField = "Dt_recep_ped"

The properties are correct??

thanks
pjm

 
Try this

PK_Processo='" & frmProcesso1.txtfields(0)& "'", If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]

[cheers]
 
Hi foada

It gives me "Data type mismatch in criteria expression"








 
what data type is PK_Processo ?

from the error I woudl guess it is numeric, therefore try taking out the ' from around teh value

i.e.

PK_Processo= " & frmProcesso1.txtfields(0),


Matt
 
Ok! the sql statement works
thanks

But, in the second question I can't put a data in the maskedbox what can be the problem. I taked all formats and mask's and still not working.

 
Try assign the field value, not the field name!


frmProcesso1.MaskEdBox1(4).DataField = rs!Dt_recep_ped
===

where rs is the recordset you just opened!

Lucky,
Carlos Paiva
 
Hi, carlos
Thanks for your help but,
It gives me a erro "Invalid use of Null".





 
Before doing the assingment, test for null:

if not IsNull(rs!Dt_recep_ped) then frmProcesso1.MaskEdBox1(4).DataField = rs!Dt_recep_ped

This should be done to whatever assignment you made, if the var type is not an variant.

Carlos Paiva
 
But if I put this condition he don't do my command.

my code in module is:

Sub LigaDbPedAvaliaObject(adoPedAvaliaRs)

Set frmProcesso1.MaskEdBox1(4).DataSource = adoPedAvaliaRs
If Not IsNull(adoPedAvaliaRs!Dt_recep_ped) Then

frmProcesso1.MaskEdBox1(4).DataField = adoPedAvaliaRs!Dt_recep_ped
End If

Set frmProcesso1.txtfields(6).DataSource = adoPedAvaliaRs
frmProcesso1.txtfields(6).DataField = "ObsPedAval"

Set frmProcesso1.MaskEdBox1(5).DataSource = adoPedAvaliaRs
frmProcesso1.MaskEdBox1(5).DataField = "Dt_envio_ped"

End Sub

I don't have null values in the record in db table.


Regards
PJM



 
xerife007

There's something wrong in here.

-You are using a BOUNDED MaskedEdit.

If so, the previous assignment is right (You should assign the field name to the DataField property.
(Sorry, but i didn't understand this way)

Are the lines of code in your 1st post, in that order?
(Open ..., Set ... , assignment of field name)

Post the code where you open the recordset.

Carlos
 
Carlos
I'm using "readonly" in conn.open.
I'm send to you the code.
Let me ask you. you are Potuguese in Portugal?

 
yes, and if u wish to contact me , my email is :
c_paiva@netcabo.pt

Regards
Carlos Paiva
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top