Results 1 to 5 of 5
  1. #1
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133

    Post I have a premiums program

    Hello Everyone

    I have a premiums program , I have SaleInvoiceF is main form and also I have 2 subforms , first subform's name is (frm_subsale) and second subform's name is ( qistF)
    Click image for larger version. 

Name:	Capture1.PNG 
Views:	30 
Size:	49.6 KB 
ID:	27518



    Can someone help me , please ?

  2. #2
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    While I don't follow your post exactly - I do get the general idea of what you seek.

    Generically: You have a record in a table with 2 fields: $600 , 1/1/17 - - - and you want to create records in table2 that is 6 records of $100, monthly sequential date.

    You need to set up a series of queries to develop this. Dealing with the $ and the dates would be done separately and then all brought together into a final append query into your table2. It could involve several queries.

    $: It is not clear to me as to why $100 rather than $125 or other - - so I am presuming somewhere is the value 6 in a record to use as a divisor of the $ value.

    Dates: Creating 6 sequential monthly dates is challenging. I would probably set them up in a query with calculated values / fields side by side - - and then via a union or cross tab query re-orient them into a record set so they are stacked.

    The presentation in your forms is the final step. I would not attempt to implement the calculations themselves at the form level - I would do it all at the query level.

  3. #3
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133
    I wrote that amount only for example , maybe be less or more it will depend about contract
    but If we make relationship between them Tables it will be good and when we create subform , we can all connect with MainForm
    and you know it better than , because I'm not very good in Microsoft Access specially with VBA
    someone sent to me code but I didn't know how I will use it correctly

    Dim rst As DAO.Recordset


    Set rst = Me.RecordsetClone


    Mobile_Cost = [qist_price]
    Fisrt_Date_of_Payment = [qist_first_date]
    Dim i
    For i = 1 To [qist_num]


    rst.AddNew
    rst![qist_number] = i
    rst![qist_price] = Mobile_Cost / [qist_number]
    rst![qist_date] = DateAdd("d", i - 1, Fisrt_Date_of_Payment)
    rst.Update


    Next i


    rst.Close: Set rst = Nothing

    I tried to use it , but I didn't know How I will use it

  4. #4
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    looping is 1 approach but will not scale in the sense it becomes very slow if applied to thousands of records; I'm not sure that's the case here so that's just an fyi

    using query and records sets is faster; first develop a query that will result in the monthly $ amount.

    then develop a query that will result in the month dates

    then join that data and append it into your table

  5. #5
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133
    I solved my problem by using code , thanks a lot for your help

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Learning how to program
    By engnrguy in forum Programming
    Replies: 4
    Last Post: 06-15-2015, 04:30 PM
  2. Access Program from Win xp to win 7
    By loijoc08 in forum Import/Export Data
    Replies: 5
    Last Post: 05-19-2014, 02:00 PM
  3. Program a 30-day trial into my Access Program?
    By genghiscomm in forum Programming
    Replies: 1
    Last Post: 05-26-2011, 02:14 PM
  4. Is Access the right program for me?
    By Cole in forum Access
    Replies: 1
    Last Post: 08-07-2010, 08:47 AM
  5. Where is my runtime program?
    By shesgone in forum Access
    Replies: 2
    Last Post: 04-02-2010, 07:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums