db Update Page

ipon70

Board Regular
Joined
May 8, 2013
Messages
82
Office Version
  1. 2016
Platform
  1. Windows
Hello,
I have a database which is just straight columns of data. From A:AO
I also created a data edit page that allows them to search by time and date and return those results. Then they can type in column E on the edit page and change the values for that time and date.
At the bottom I am capturing the database entry number, time, date etc..along with the previous entry if they don't update all of it and only update 1 or 2 entries.
The below code is just making a new line, instead of editing the line it was on.
Like if entry 03/15/2023 at 0900 and that was database entry 619, I change one entry from 568925 to 568926 it should just copy all the old entries and then take the new entry and put it in at 619. A60-AK60 has all of the data including the database entry code for the edit. If you need more information please ask.

Thanks for any help

Sub db_update_entry()
Application.ScreenUpdating = False
Sheets("Entry Edit").Range("A60:AK60").Copy
Worksheets("db").Activate
Dim CompId As Range
Set CompId = Range("A:A").Find(what:=Range("AO1").Value, LookIn:=xlValues, lookat:=xlWhole)
Range(CompId.Offset(, 0), CompId.Offset(, 0)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
UserName = Environ("username")
CompId.Offset(, 39).Value = UserName
CompId.Offset(, 40).Value = Date
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hello,
I have a database which is just straight columns of data. From A:AO
I also created a data edit page that allows them to search by time and date and return those results. Then they can type in column E on the edit page and change the values for that time and date.
At the bottom I am capturing the database entry number, time, date etc..along with the previous entry if they don't update all of it and only update 1 or 2 entries.
The below code is just making a new line, instead of editing the line it was on.
Like if entry 03/15/2023 at 0900 and that was database entry 619, I change one entry from 568925 to 568926 it should just copy all the old entries and then take the new entry and put it in at 619. A60-AK60 has all of the data including the database entry code for the edit. If you need more information please ask.

Thanks for any help

Sub db_update_entry()
Application.ScreenUpdating = False
Sheets("Entry Edit").Range("A60:AK60").Copy
Worksheets("db").Activate
Dim CompId As Range
Set CompId = Range("A:A").Find(what:=Range("AO1").Value, LookIn:=xlValues, lookat:=xlWhole)
Range(CompId.Offset(, 0), CompId.Offset(, 0)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
UserName = Environ("username")
CompId.Offset(, 39).Value = UserName
CompId.Offset(, 40).Value = Date
Application.ScreenUpdating = True
End Sub
Never mind, the whole thing works, I forgot to add the database number reference to the database page at AO1

Fixed
 
Upvote 0

Forum statistics

Threads
1,215,334
Messages
6,124,319
Members
449,153
Latest member
JazzSingerNL

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