How to retrive any complete row in the data base which my program does.

adelagza

New Member
Joined
Sep 25, 2018
Messages
13
Hi, I have a program that once its done it saves a report in a database on the type of a row from "B:AF" and every time that a new report its done it is saved in the next row, however I have not been able to retrieve any of those lines when deemed necessary, my program its done in VBA and macros and I would like to have another Macro to retrieve any of those reports when necessary.

Hint: You can go to the DataBase and choose whatever report you want to be retrieved, the problem is How it can be done? Thanks in advance for any help you can do to solve this problem!!!
 
Last edited:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
It would be helpful if you published the code that posts the record to your database.

Dave
 
Upvote 0
Thanks OldBrewer for your reply, the answer to your question is NO I did not place a unique ID in the first column, but thinking of any changes I did left open the "A" column for whatever it might be needed!!
 
Upvote 0
Hi Dave, I can of course publish the code, but to be truthful, I do not know hot to do it, I have read the information fro the Forum, but belive me I do not know how to handle it, I can copy and paste, but of course those files I belive will be only text!!!, anyway I will try to place the files as soon as possible and thanks for your interest in my problem, AGUSTIN
 
Upvote 0
Here it the code:
Attribute VB_Name = "Módulo4"
Option Explicit
Sub Resultados_Guardar()
Attribute Resultados_Guardar.VB_ProcData.VB_Invoke_Func = "G\n14"
'Declaración de Variables
Dim strTitulo As String
Dim Continuar As String
Dim RangoDatos As Range
Dim NuevaFila As Integer
Dim Limpiar As String


strTitulo = "Pratt Industries"


Continuar = MsgBox("Dar de Alta los Datos?", vbYesNo = vbInformation, strTitulo)
If Continuar = vbNo Then Exit Sub
Set RangoDatos = ThisWorkbook.Worksheets("Guardar").Cells(1, 1).CurrentRegion
NuevaFila = RangoDatos.Rows.Count + 1
With ThisWorkbook.Worksheets("Guardar")


.Cells(NuevaFila, 2).Value = ThisWorkbook.Sheets("Resultados").Range("E12")
.Cells(NuevaFila, 3).Value = ThisWorkbook.Sheets("Resultados").Range("E13")
.Cells(NuevaFila, 4).Value = ThisWorkbook.Sheets("Resultados").Range("E14")
.Cells(NuevaFila, 5).Value = ThisWorkbook.Sheets("Resultados").Range("E15")
.Cells(NuevaFila, 6).Value = ThisWorkbook.Sheets("Resultados").Range("E18")
.Cells(NuevaFila, 7).Value = ThisWorkbook.Sheets("Resultados").Range("F18")
.Cells(NuevaFila, 8).Value = ThisWorkbook.Sheets("Resultados").Range("G18")
.Cells(NuevaFila, 9).Value = ThisWorkbook.Sheets("Resultados").Range("K17")
.Cells(NuevaFila, 10).Value = ThisWorkbook.Sheets("Resultados").Range("E20")
.Cells(NuevaFila, 11).Value = ThisWorkbook.Sheets("Resultados").Range("E21")
.Cells(NuevaFila, 12).Value = ThisWorkbook.Sheets("Resultados").Range("E27")
.Cells(NuevaFila, 13).Value = ThisWorkbook.Sheets("Resultados").Range("E31")
.Cells(NuevaFila, 14).Value = ThisWorkbook.Sheets("Resultados").Range("E32")
.Cells(NuevaFila, 15).Value = ThisWorkbook.Sheets("Resultados").Range("E33")
.Cells(NuevaFila, 16).Value = ThisWorkbook.Sheets("Resultados").Range("E34")
.Cells(NuevaFila, 17).Value = ThisWorkbook.Sheets("Resultados").Range("E36")
.Cells(NuevaFila, 18).Value = ThisWorkbook.Sheets("Resultados").Range("K20")
.Cells(NuevaFila, 19).Value = ThisWorkbook.Sheets("Resultados").Range("K21")
.Cells(NuevaFila, 20).Value = ThisWorkbook.Sheets("Resultados").Range("K23")
.Cells(NuevaFila, 21).Value = ThisWorkbook.Sheets("Resultados").Range("K24")
.Cells(NuevaFila, 22).Value = ThisWorkbook.Sheets("Resultados").Range("K25")
.Cells(NuevaFila, 23).Value = ThisWorkbook.Sheets("Resultados").Range("K26")
.Cells(NuevaFila, 24).Value = ThisWorkbook.Sheets("Resultados").Range("K27")
.Cells(NuevaFila, 25).Value = ThisWorkbook.Sheets("Resultados").Range("K31")
.Cells(NuevaFila, 26).Value = ThisWorkbook.Sheets("Resultados").Range("K32")
.Cells(NuevaFila, 27).Value = ThisWorkbook.Sheets("Resultados").Range("K33")
.Cells(NuevaFila, 28).Value = ThisWorkbook.Sheets("Resultados").Range("K35")
.Cells(NuevaFila, 29).Value = ThisWorkbook.Sheets("Resultados").Range("K37")
.Cells(NuevaFila, 30).Value = ThisWorkbook.Sheets("Resultados").Range("K41")
.Cells(NuevaFila, 31).Value = ThisWorkbook.Sheets("Resultados").Range("K42")
.Cells(NuevaFila, 32).Value = ThisWorkbook.Sheets("Resultados").Range("K43")

End With

MsgBox "Alta OK", vbInformation, strTitulo
Limpiar = MsgBox("Desea limpiar lo campos de 'Resultados'?", vbYesNo, strTitulo)
If Limpiar = vbYes Then

With ActiveWorkbook.Sheets("Resultados")
.Range("E12").ClearContents
.Range("E13").ClearContents
.Range("E14").ClearContents
.Range("E15").ClearContents
.Range("E18").ClearContents
.Range("F18").ClearContents
.Range("G18").ClearContents
.Range("K17").ClearContents
.Range("E20").ClearContents
.Range("E21").ClearContents
.Range("E27").ClearContents
.Range("E31").ClearContents
.Range("E32").ClearContents
.Range("E33").ClearContents
.Range("E34").ClearContents
.Range("E36").ClearContents
.Range("K20").ClearContents
.Range("K21").ClearContents
.Range("K23").ClearContents
.Range("K24").ClearContents
.Range("K25").ClearContents
.Range("K26").ClearContents
.Range("K27").ClearContents
.Range("K31").ClearContents
.Range("K32").ClearContents
.Range("K33").ClearContents
.Range("K35").ClearContents
.Range("K37").ClearContents
.Range("K41").ClearContents
.Range("K42").ClearContents
.Range("K43").ClearContents

End With

Else

End If
End Sub
 
Upvote 0
Here its the information on the data base (Only two lines now, it might grow more!!) it seems that it does NOT COPY complete, but you have an idea from column B to column AF.

C L I E N T E No. De PARTE REP DE VENTAS FECHA LARGO EMPAQUE ANCHO EMPAUE ALTO EMPAQUE PERIMETRO CAJA PESO DEL CONT. ? CAMAS PESO SOBRE PRIMER CAMA MEDIDAS DIV. LARGA ? X CAJA MEDIDAS DIV. CORTA ? X CAJA PERIMETRO TOTAL DIV. TIEMPO ALMACENAJE HUMEDAD RELATIVA ESTIBAS DESALINEADAS ESTIBAS TRABADAS SOBRESALIDO?? ABERTURA EN TABLAS TARIMA SOBREMANEJO PARTE # 1 PARTE # 2 PARTE # 3 PERIMETRO PARTES FACTOR SEGURIDAD ECT SOLO ECT CON DIV. ECT O. PTES.
PRUEBA DEL PROGRAMA BCT UNICO AGUSTIN DE LA GARZA 27/11/2018 70 62 48 264 65 4 195 64.5 3 56.5 56.5 4 60 60 X X 0 X X 244.4 244.4 3.8 48 0 23
PRUEBA DEL PROGRAMA BCT 2 UNICO 2 VERONICA RODRIGUEZ 29/11/2018 58 49 50 214 48 5 192 0 0 0 0 0 45 70 X X X X X 0 0 0 0 4 42
 
Last edited:
Upvote 0
Hi,
sorry for slow reply - been tad busy.
Would be your intention to retrieve a record from your database by say just double clicking the record to return it to your input sheet?

Dave
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,892
Members
449,058
Latest member
Guy Boot

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top