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

Simple Question

Status
Not open for further replies.

bzyrice

MIS
Oct 15, 2003
4
0
0
US
I have alot of information that needs to be inputed into a an access 2000 table. I want to be able to add multiple records with the click of a command button. So I went ahead and created a Form with multiple text boxes where I would get the information for the table. Then I created a command button that I would click to add all the records. Does anyone have any sample code that would do this?

Sorry I haven't used Access 2000 and Visual Basic for awhile now and I got stumped when I started to do this project as a favor ;) Thanks in advanced. Here's the names:
Database: Mosaix_Database
Table: tbl_Record_Selections
Form: frm_Record_Selections
Text Boxes: txt_1 , txt_2, txt_3 etc ...
 
the simple way would be to use a form bound to the table.use the form wizard to create your form
Access does the rest for you
 
yah but i believe when u use wizard it only allows u to do one record at a time... I want to do more than one record at a time..
 
why do you need to add more than one record to a table, the above is correct
 
I want to add 30 records at one time... I am trying to create an appication for my company where they won't have to continue to hit an add button until they are done... one add buton for 30 add records.. I am just trying to make it easy for the user... I know VB code will be needed.. I was just hoping someone could help me. The problem I am having is that I cannot asign a text box to a variable I have in VB. I keep getting the error block variable not defined.
 
Use the wizard as suggested before, but change your default view in the properties to "continuous forms", which will show all of your records at once and continue to add lines as your user adds data. Good luck!
 
to add 30 records at a time rather defeats the purpose of using an access form for data entry.To add 30 records as you suggest would have to be done on an unbound form with 30 txt boxes and 30 labels etc.What happens if there are 31 records?.Then you would need to use VBA to save the 30 entries.A lot of work for you!
 
See I know for a fact that the 30 records will not change... the reason why I want to update 30 records at once is also because 3 out of the 5 fields are the same everyday... for example the 5 fields are list#,job name,date, # of records and notes... the first of these 3 fields are the same every day... I need to have the amount of records each job has everyday. the easiest way for a user to input this data is to have one form they can refer to... which automatically inputs the first 3 fields for the 30 different jobs... anyone do anything like this? I just need to be able to refer to a text box and assign it to a variable in VB ... here's some code:

Private Sub cmd_Add1_Click()
On Error GoTo Err_cmd_Add1_Click

'Dim dbsDatabase As Database
'Dim rstRecords As Recordset
Dim frm_RS As Form_frm_Record_Selection
'Dim RS_Date As Date
'Dim strList As String
'Dim strName As String
'Dim dblRecords As Double
'Dim strNotes As String

'Open Database and Table(Recordset)
'Set dbsDatabase = OpenDatabase("S:\AR_Public\RM Outbound\Mosaix\Mosaix Admins\Roderick\Database\Mosaix_Database.mdb")
'Set rstRecords = dbsDatabase.OpenRecordset("tbl_Record_Selections", dbOpenDynaset)

'Get Data
RS_Date = frm_RS.txt_Date.Text
strList = frm_RS.lbl_2G_List1.Caption
strName = frm_RS.lbl_2G_Name1.Caption
dblRecords = frm_RS.txt_2G_Rec1.Text
strNotes = frm_RS.txt_2G_Notes1.Text

'DoCmd.GoToRecord , , acNewRec

'Close Table and Database
'rstRecords.Close
'dbsDatabase.Close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top