What's wrong (1 Viewer)

b0gdan

Me
Local time
Today, 05:52
Joined
Oct 5, 2006
Messages
29
Hi,
Can anyone tell me what's wrong with this:
DoCmd.RunSQL "INSERT INTO tblPersoaneJuridice (Denumire,Localitate,CodUnicInregistrare,NumarInregistrareRegComertului,Telefon,Fax) VALUES ('" & Forms!frmPrincipal!subfrmTipVersus!txtDenumire & "','" & Forms!frmPrincipal!subfrmTipVersus!txtLocalitate & "','" & Forms!frmPrincipal!subfrmTipVersus!txtCUI & "','" & Forms!frmPrincipal!subfrmTipVersus!txtNumarInregistrare & "','" & Forms!frmPrincipal!subfrmTipVersus!txtTelefon & "','" & Forms!frmPrincipal!subfrmTipVersus!txtFax & "')"
cui = DLookup("[CodUnicInregistrare]", "[tblPersoaneJuridice]", "[NumarInregistrareRegComertului]='" & Me!subfrmTipVersus!txtNumarInregistrare & "'")

i have a string variable denoted by cui and i need it to take value from table tblPersoaneJuridice from field CodUnicInregistrare. CodUnicInregistrare and NumarInregistrareRegComertului is text.
 

Oldsoftboss

AWF VIP
Local time
Today, 22:52
Joined
Oct 28, 2001
Messages
2,499
cui = DLookup("[CodUnicInregistrare]", "[tblPersoaneJuridice]", "[NumarInregistrareRegComertului]='" & Me!subfrmTipVersus!txtNumarInregistrare & "'")

Change the

Me!subfrmTipVersus!txtNumarInregistrare

to

Forms!MainformName.Form!sumfrmTipVersus.Form!txtNumarInregistrare

for some reason SOMETIMES Dlookups dont like the "ME" bit

Dave
 

b0gdan

Me
Local time
Today, 05:52
Joined
Oct 5, 2006
Messages
29
Thanks

..but still nothing. The variable doesn`t take the value from table, a message appears saying "insert parameter value"...the same thing as before.
 

jkl0

jkl0
Local time
Today, 08:52
Joined
Jun 23, 2006
Messages
192
Try this version.

cui = DLookup("[CodUnicInregistrare]", "[tblPersoaneJuridice]", "[NumarInregistrareRegComertului]='" & Me!subfrmTipVersus!Form!txtNumarInregistrare & "'")
 

Users who are viewing this thread

Top Bottom