Results 1 to 5 of 5

Thread: ListView Problem, Urgently need help!

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    8

    Exclamation

    Hi can anyone show me the codes to do this:

    I have 2 forms. One for order entry and the other for adding items to the order entry. Both of them has ListView.

    I have these fields(Item Number, Description, Quantity) in the ListView. An i have records in the ListView under those fields.
    When i select/click on one of the rows of records, I need to enable a option button (Yes, i want to add this item to my order), and when i click on the option button, the Add command button will enable. When i click the Add command button, i must save whatever the row that i have selected/clicked to a variable. What are the codes to do it?
    Then in the order entry form the ListView will show the recent item that i have selected in the item form.

    I have Set rst= New Recordset and dbs=New deOrderEntry (deOrderEntry is my Data Environment Designer)
    Can anyone please help me? I need it really urgently. Thanks for your help!

  2. #2
    Lively Member
    Join Date
    Sep 2000
    Posts
    68
    You need to go through the recordset and populate the list box.

    Then when the user clicks on Add, check which listbox item is selected and send the relevant record to the second form.

    Do until RS.eof
    List1.AddItem Rs.Fields("Name")
    Rs.moveNext
    loop

    This will popluate the list box,

    Then you need to send the record to the other form. You can do this by either sending it unique key, or sending a string containing a unique field from the db..

    It depends, what will the second form need to do...?????

    THE DOUGSTER!!!!!!


    *-MCSD-*

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    8
    Sorry to bother again, but i have another question.
    I have some records(around 10 Invoices) in the database(Access 97). And when the order entry form loads, i need the next record to be displayed in the invoice textbox (let's say 11 will be display automatically when that form loads).

    I've tried using RecordCount this way but it didn't work. deOrderEntry is my DataEnvironment. And OrderEntry is my DEConnection.

    Dim dbs As deOrderEntry
    Dim rst As Recordset
    Dim strsql As String
    Dim Records As Long
    Dim strRecords As String

    Set dbs = New deOrderEntry
    Set rst = New Recordset

    dbs.OrderEntry.Open "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=C:Finalised VBPro\Ordersys.mdb"
    strsql = "SELECT Customer.CustomerID FROM Customer WHERE Customer.Name = '" & txtCustName.Text & "'"



    rst.Open strsql, dbs.OrderEntry
    rst.MoveFirst
    Records = rst.RecordCount 'count the number of existing records
    txtInvoiceNo.Text = strRecords + 1
    strRecords = CStr(Records)

    Thanks for your help again!


  4. #4
    Lively Member
    Join Date
    Jul 2000
    Posts
    104
    If I understand correctly...you want the last record in the set to be displayed, right?

    If so use the rs.MoveLast method and then display the record however you want. If you need to navigate elsewhere in the set just use the other Move methods from the recordset object.

    You could order the records by date when you query the database and just display the latest one to the user. This is if I understood correctly.

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    8
    Sorry for the vague idea. What i meant was that i need the invoice number of the new order form to be displayed.

    (I have 10 invoice numbers, when i load the order form to create a new invoice, the invoice number textbox should display 11 which means the new invoice that is being created should have the invoice number of 11)

    Thanks for your help again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width