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

Entering data horizontally on forms

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
I would like to be able to enter data into successive records on a form...horizontally instead of vertically. This would only require 1 field entry for each record. The gain is, I can enter much more data without scrolling (continuous form). I believe 3 or 4 columns would be enough. So, record 1 field 1 is first, record 2 fiel2 1 would be to the right of the first and record 3 field 1 would be to the right of that6. Record 4 field 1 would be under record 1 field 1. Record 5 field 1 would be under record 2 field 1....etc. This example is only showing 3 columns of 3 records but could be 4 & 4.

Like

R1Field1 R2Field1 R3Field1
R4Field1 R5Field1 R6Field1
R7Field1

etc

Can this be done? If so, how?
 
Thanks Duane.

Can you give me one short example with code please?
 
Can you provide some table and field names? Is there only one field in the table?

Can we assume these are just new records?

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Table: Attendee Field Name: NameID

I will use a combo box to look up a person and it will populate the NameID field with the NameId from the Combo box. The NameID will be an auto generated number.

Thanks,
 
From your requirements, this should add the records to a table

Code:
Private Sub cmdSave_Click()
    [COLOR=#4E9A06]'this assumes there are consecutively numbered controls with a specific prefix[/color]
    Dim intNameCount As Integer
    Dim intI As Integer
    Dim intAdded As Integer
    Dim strSQL As String
    Dim strCtrlNamePrefix As String
    intNameCount = 12  [COLOR=#4E9A06]'the number of controls here[/color]
    strCtrlNamePrefix = "cboNameID"
    For intI = 1 To intNameCount
        If Not IsNull(Me(strCtrlNamePrefix & intI)) Then
            strSQL = "INSERT INTO Attendee (NameID) Values (" & Me(strCtrlNamePrefix & intI) & ")"
            CurrentDb.Execute strSQL, dbFailOnError
            intAdded = intAdded + 1
        End If
    Next
    MsgBox "Added " & intAdded & " names to Attendance table.", vbInformation + vbOKOnly, "Complete"
End Sub

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thanks Duane I will give this a try. Question...does the number controls equate to the number of horizontal controls I want?
 
puforee said:
does the number controls equate to the number of horizontal controls I want
There is no horizontal or vertical in my solution, only control names. Place the controls in a circle if you desire.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top