StartingOut
Board Regular
- Joined
- Feb 1, 2011
- Messages
- 92
Hi I have UserForm1 that writes 30+ items (TextBoxes, CheckBoxes, OptionButtons, and 2 ComboBoxes) to a batabase sheet. Each time the form opens UserForm1 generates a sequential Invoice number based on the last time data was writen to the Database. This sequential number is places in column "A" on the row with the data. I want to be able to open another Form "UserForm2" with the exact same group of TextBoxes and checkBoxes. In the TextBox on UserForm2 that from UserForm1 held the automaticaly generated sequential number I want to input any of the previous generated numbers which will then search for the row and then bring that row data back into the userform. after it is edited click an update buton which writes the data back to the Database sheet in the same row that the original data was held or delete the old row and write a new row so there is not duplicate entry
Her is sample of my code that send the data to the database sheet, I hope this questing is not to long. If it helps the TextBox that holds the sequential number is TextBox53.Value
With Worksheets("DataBase")
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Cells(NextRow, 1).Value = TextBox53.Value
.Cells(NextRow, 2).Value = ComboBox1.Value
.Cells(NextRow, 3).Value = TextBox19.Value
.Cells(NextRow, 4).Value = CheckBox1.Caption
.Cells(NextRow, 5).Value = TextBox1.Value
.Cells(NextRow, 6).Value = TextBox2.Value
.Cells(NextRow, 7).Value = TextBox3.Value
.Cells(NextRow, 8).Value = TextBox10.Value
.Cells(NextRow, 9).Value = TextBox11.Value
.Cells(NextRow, 10).Value = TextBox40.Value
.Cells(NextRow, 11).Value = TextBox41.Value
.Cells(NextRow, 12).Value = TextBox42.Value
.Cells(NextRow, 13).Value = TextBox43.Value
.Cells(NextRow, 14).Value = TextBox44.Value
.Cells(NextRow, 15).Value = TextBox4.Value
.Cells(NextRow, 16).Value = TextBox5.Value
Her is sample of my code that send the data to the database sheet, I hope this questing is not to long. If it helps the TextBox that holds the sequential number is TextBox53.Value
With Worksheets("DataBase")
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Cells(NextRow, 1).Value = TextBox53.Value
.Cells(NextRow, 2).Value = ComboBox1.Value
.Cells(NextRow, 3).Value = TextBox19.Value
.Cells(NextRow, 4).Value = CheckBox1.Caption
.Cells(NextRow, 5).Value = TextBox1.Value
.Cells(NextRow, 6).Value = TextBox2.Value
.Cells(NextRow, 7).Value = TextBox3.Value
.Cells(NextRow, 8).Value = TextBox10.Value
.Cells(NextRow, 9).Value = TextBox11.Value
.Cells(NextRow, 10).Value = TextBox40.Value
.Cells(NextRow, 11).Value = TextBox41.Value
.Cells(NextRow, 12).Value = TextBox42.Value
.Cells(NextRow, 13).Value = TextBox43.Value
.Cells(NextRow, 14).Value = TextBox44.Value
.Cells(NextRow, 15).Value = TextBox4.Value
.Cells(NextRow, 16).Value = TextBox5.Value