Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Unanswered: MS Access DataGrid Help

    Hi,

    For the first time I am trying to use DataGrid instead of sub form.

    The BE is on Server and FE is MS Access db. The connectivitiy of the Main form thru ADODB is ok. The Main form is set to get the data from header table named T_SalesInvoiceHead. The DataGrid's information will want to store in a footer table called T_SalesInvFoot.

    Using Datagrid's property I named column headings and entered respective field names in the DataGrid. But I need to know how I can set row source to this DataGrid. Currently I can not enter or move into the columns of the DataGrid.

    My plan is to place a combo box for the items that generated from table T_ProductMaster (same like sub form) and pull the related column data of the recordset and throw on to other fields of the DataGrid.

    For your reference, field names in table T_ProductMaster are as under.

    ProductCode
    ProductName
    SalesPrice

    Same field names are entered in the DataGrid.

    How can I make rowsource for this datagrid?

    With kind regards,
    Ashfaque
    Last edited by Ashfaque; 03-19-07 at 06:03.

  2. #2
    Join Date
    Sep 2006
    Posts
    265
    It would appear that you're got the basics of your requirement already. Your invoice contains Header and Detail (Footer) information. In the footer table create fields:

    T_SalesInvFoot.[InvProductCode]
    T_SalesInvFoot.[InvProductQty] (if multiples are sold)
    T_SalesInvFoot.[InvProductPrice] (covers any future price changes)

    ComboBox contains Lookup of:

    ProductCode (bound to T_SalesInvFoot.[InvProductCode]
    ProductName
    SalesPrice

    Your Query contains a links by the two tables T_SalesInvFoot and T_ProductMaster using the InvProductCode and ProductCode. Your SubForm uses this query and has:

    T_SalesInvFoot.[InvProductCode]
    T_ProductMaster.[Product Name]
    T_SalesInvFoot.[InvProduct Price]

    Essentially you transfer the ProductCode and ProductPrice from T_ProductMaster to T_SalesInvFoot the former by the binding and the later on AfterUpdate of the T_SalesInvFoot.[InvProductCode]

    T_SalesInvFoot.[InvProductPrice] = T_ProductMaster.[ProductPrice].

    You don't need to use these naming conventions as This is an explanation of the principles involved - the actual coding is up as to how you wish to go about it - if you help let me know.

    Simon

  3. #3
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    ComboBox contains Lookup of:

    ProductCode (bound to T_SalesInvFoot.[InvProductCode]
    ProductName
    SalesPrice
    No.

    The combo will be based on T_ProductMaster table which holds ProductName, SalesPrice and other key fields.

    T_SalesInvFoot also holds same naming colums as ProductCode, Productname, SalesPrice.

    My question is when I placed grid and ammended columns as per my requirement, how can I add records into these grid field if records are more than one?

    Moreover, I need to always update quantity field as and when required then how can I put the Amount = (Qty x SalesPrice) whiile grid cells / fields are locked and I can not enter in them.

    Regards,
    Ashfaque

  4. #4
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks Simon,

    ComboBox contains Lookup of:

    ProductCode (bound to T_SalesInvFoot.[InvProductCode]
    ProductName
    SalesPrice
    No.

    The combo will be based on T_ProductMaster table which holds ProductName, SalesPrice and other key fields.

    T_SalesInvFoot also holds same naming colums as ProductCode, Productname, SalesPrice.

    My question is when I placed grid and ammended columns as per my requirement, how can I add records into these grid field if records are more than one?

    Moreover, I need to always update quantity field as and when required then how can I put the Amount = (Qty x SalesPrice) whiile grid cells / fields are locked and I can not enter in them.

    Regards,
    Ashfaque

  5. #5
    Join Date
    Sep 2006
    Posts
    265
    The Subform should allow Edit and Add and on the last Record if record Selectors there should be an asterisk. This denotes new record. If you go into the combibox and change it then a new record should be created.

    On your Subforms Query TotalValue should be declared:

    T_SalesInvFooter.[Qty] * T_SalesInvFooter.[Price]

    Its faster to do this calculation at the query level although there is nothing to stop you doing this on the form itself but the query caculation can also be used in the Invoice you produce.

    Simon

  6. #6
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Simon,

    It is not sub form. It is Datagrid and thats my question how can I add one or more than record in the grid while it does not have any record source like actual sub form we do. I checked property of the Datagrid and I did not find any way to supply record source for it.

Posting Permissions

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