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

Problems with code in access XP

Status
Not open for further replies.

rogerarce

Technical User
Jan 24, 2002
57
CR
I have the following event that is doing ok in access 2000
but for some reason it is not working fine in access XP.
I'm pasting the code here, please let me know if I have to change something:


Dim donde As String
Dim donde2 As String
Dim rstlineas As Recordset
Dim strdisp As String
Set db = CurrentDb()

db.Execute ("INSERT INTO LineasFacturas ( NumeroFactura,IdProveedor, CodPlanta, Tamaño, Descripcion, PrecUnitario, Cantidad, CodNauca, Tip ) " _
& " SELECT DISTINCTROW " & Form_FrmEncFactura.NumeroFactura & ",LinListasEmpaque.IdProveedor, LinListasEmpaque.CodPlanta, LinListasEmpaque.Tamaño, LinListasEmpaque.Descripcion, LinListasEmpaque.PrecUnitario, Sum(LinListasEmpaque.Cantidad) AS [Suma De cantidad], LinListasEmpaque.CodNauca, LinListasEmpaque.Tip" _
& " FROM LinListasEmpaque" _
& " WHERE (((LinListasEmpaque.NoListaEmpaque)= " & Form_FrmEncFactura.NoListaEmpaque & "))") _
& " GROUP BY LinListasEmpaque.IdProveedor, LinListasEmpaque.CodPlanta, LinListasEmpaque.Tamaño, LinListasEmpaque.Descripcion, LinListasEmpaque.PrecUnitario, LinListasEmpaque.CodNauca, LinListasEmpaque.Tip, LinListasEmpaque.NoListaEmpaque" _

Form_FrmEncFactura.Requery
Form_FrmSubLineasFacturas.Requery


Thanks in advanced for your help.
 
What is the error message that you are getting? Or is there a compile problem?

A few ideas that might help.

1. I don't see a declaration for db, however, you issue:
Set db = Currentdb()

This statement is OK if db is a global or module level variable. If not, then db is declared by default to be a variant instead of a dao.database. This might be a problem.

2. It appears that you are using a foreign language version of Access (Spanish?). I don't know anything about the use of special characters in those versions, but the accented characters stand out to me. If you are getting an error message that deals with the SQL statement, I would try putting the field names that have special characters into square brackets:

[LinListasEmpaque].[Tamaño]

3. What is "Form_FrmEncFactura"? The syntax of this name appears to be the internal module name for the vba code behind a form. If you are trying to reference a control on a form, the you must use:

Forms("FormName").ControlName
or
Forms!FormName!ControlName

4. The following line appears to be the end of your SQL statement

LinListasEmpaque.NoListaEmpaque" _

You can't end a statement with the line continuation character (_). The compiler will be expecting the next line to be part of this one.

Again, without knowing what error you are getting it is hard to diagnose. However, I find it difficult to believe that this code worked under Access 2000. Please review your post. Is some of the code missing?

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top