Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub cmdAddPosition_Click()
- Dim i As Integer
- Me.lstAddPositions.ColumnCount = 7
- If Me.txtAddPos.Value = i And i > 0 And i < 50 Then
- Me.lstAddPositions.AddItem (Me.txtAddPos.Value)
- 'Me.lstAddPositions.AddItem(Me.txtAddPos.Value,(i))
- Me.lstAddPositions.List(0, i) = Me.txtAddPos.Value
- 'Me.lstAddPositions.Column(0, i) = Me.txtAddPos.Value 'adding number of position
- 'Me.lstAddPositions.Column(2, i) = Me.lstAddHidden.Column(0, 0) 'adding titel
- End If
- Me.lstAddPositions.Requery
- End Sub
- Private Sub cmdAddPosition_Click()
- Dim i As Integer
- Me.lstAddPositions.ColumnCount = 7
- If Me.txtAddPos.Value = i And i > 0 And i < 50 Then
- Me.lstAddPositions.AddItem "Col1" & "," & "col2" & "," & "Col3" & "," & _
- "Col4" & "," & "Col5" & "," & "col6" & "," & "col7" &";"
- End If
- Me.lstAddPositions.Requery
- End Sub
- DROP TABLE Test;
- CREATE TABLE Test (TestID AUTOINCREMENT(1, 1),
- TestName TEXT,
- TestDescription TEXT,
- CONSTRAINT TestPKey PRIMARY KEY (TestID));
- INSERT INTO Test (TestName, TestDescription)
- VALUES ('Test A', 'Testing Record A')";
- INSERT INTO Test (TestName, TestDescription)
- VALUES ('Test B', 'Testing Record B')";
- INSERT INTO Test (TestName, TestDescription)
- VALUES ('Test C', 'Testing Record C')";
- Private Sub TestButton_Click()
- Dim rst As DAO.Recordset
- Dim fld As DAO.Field
- Dim lb As ListBox
- Dim rowStr As String
- Set rst = CurrentDb.OpenRecordset("Test")
- Set lb = Me.TestListBox
- ' Set the number of listbox columns to reflect recordset fields
- lb.ColumnCount = rst.Fields.Count
- ' Set the row source type to Value List
- lb.RowSourceType = "Value List"
- ' Erase the listbox data so we can populate it
- lb.RowSource = ""
- ' If ColumnHeads property is enabled, then first record is field
- ' names. Lets populate those.
- If lb.ColumnHeads Then
- rowStr = ""
- ' Build a string for each record
- For Each fld In rst.Fields
- rowStr = rowStr & replace(fld.Name,",","") & ","
- Next
- ' Strip final comma
- rowStr = Left(rowStr, Len(rowStr) - 1)
- ' Add each record (all fields) at once.
- lb.AddItem rowStr
- End If
- ' Loop through each record
- Do Until rst.EOF
- ' Build a record string and add it
- rowStr = ""
- For Each fld In rst.Fields
- rowStr = rowStr & replace(fld.Value,",","") & ","
- Next
- rowStr = Left(rowStr, Len(rowStr) - 1)
- lb.AddItem rowStr
- rst.MoveNext
- Loop
- ' Close and release objects
- rst.Close
- Set fld = Nothing
- Set rst = Nothing
- Set lb = Nothing
- End Sub
- Me.listbox2.AddItem (Me.listbox1.Column(0) & ";" & Me.listbox1.Column(1))
- Dim strName as string
- strName=String1&";"&String2
- Me.listName.addItem strName
Add Comment
Please, Sign In to add comment