CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 55
  1. #31
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: How to show a form thru for next loop

    I have not looked at your files but in general you would Create a table for Customers that has all of the customer info with a field like CustomerID which would be defined as a primary key.
    In your order table there would be a customer field that would hold the CustomerId of the customer. These 2 fields should be set as your relationship.

    To select data from the 2 tables you can simply use a join statement

    ETA I didn't see the post by Jonny
    Last edited by DataMiser; August 13th, 2009 at 02:37 PM.

  2. #32
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to show a form thru for next loop

    Quote Originally Posted by DataMiser View Post
    ...To select data from the 2 tables you can simply use a join statement

    ETA didn't see the posy by Jonny
    Yep right and here is the already corrected database. There are still some questions to discuss but this we will maybe do later if needed.
    Attached Files Attached Files
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  3. #33
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to show a form thru for next loop

    Quote Originally Posted by dsrahul View Post
    Dear Pop,

    There must be lot of ADODC to play with, Opening two database at the same time & matching them for the exact output or Display.Wll Mshflexgrid show both at the same time?
    Yes when the datasource is a query no problem.
    Quote Originally Posted by dsrahul View Post
    Next is By using Word I can only fill a single record, if there are multiple record for the same customer, How will I populate it?
    You simple need to code your word document. so it is correctly filled with data
    Quote Originally Posted by dsrahul View Post
    Datareport option has limitations, It cant show ReportNo & Labcode no just below the Pagehead.It is to be inserted in details section.
    No this isn't the point, I'll learn you how to do this.

    Quote Originally Posted by dsrahul View Post
    Thus breaking a line between record & repeating the sentence Repno 123 Labcode 2022 after each Record, which is unwanted ,
    I dont understand you maybe a language problem.
    Generally Word or Excel can do whatever you want, Tables
    with lots of records, pagebreak and all that things
    Quote Originally Posted by dsrahul View Post
    The Requirements are:-
    1) A customer may have 1 sample or many samples,The category of the sample may vary.
    He might give us 5 Iron samples 3 Coal Samples 1 Food grain sample.Or Maybe only any of these.( They basically Test all liquid/Solid/God/Silver/Chemical/Food Products/Grains/Coals etc etc.
    Ok thats nearly done
    Quote Originally Posted by dsrahul View Post
    2) They want to enter CustomerData once, & in future if he comes back he is easily found in the database.He wont have any unique ID.
    There is absolutly no problem with what he wants, except the inner construction. A Customer like your boss is your customer and he can want what his needs are, but he can never do prescriptions of how the program works in its inner mechanics
    A unique key is BASIC BASIC for working with databases. How we will identify Mr Mayr, Boston in difference to Mr Mayr, Vienna without any unique key ? There are to much Jimmy's Johns and Peters on the world.
    Its usual, that the user is not involved in internal behaviour, so he may not see the unique key. But yu need to have one.
    Normally you have a searate form where you enter data and a form where you search your customer by his name. And if you find e.g. 10 persons named Smith the searching window will show you a list of all of them ( with additional data like adress phone no -- so on)
    so you can decide which Mr Smith you want to choose and this one and his sample records are shown in the Gridview then

    Quote Originally Posted by dsrahul View Post
    3) If at any point of time the customer need the report for which samples he tested, a report can be given for all the tests he had done.
    The report must be in MS-Word 2003.I am attaching the Document with this.
    This is usual behaviour.
    Quote Originally Posted by dsrahul View Post
    The sample testing takes time so, immediately after testing one sample the Package may be left open until next sample is inputted or the package is closed to open once gaing to continue inputting the other test reports after completion of sample testing.
    I did not understand what a package is in your case and whats 'gaing' is, (cannot translate that, I know what gay means but I think thats not the translation
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  4. #34
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to show a form thru for next loop

    If you look to the yellow rectangle this are all the customers data. The red rectangle are data that are sample depending isn't it ?
    Or is there a third step involved ?
    I'll give you an example what I'm talking about.
    We also have customers but we repair electronic devices.
    So acostumer may give us lots of orders and each order may contain different devices to be repaired
    So we have a customers table and a bills Table, but because each bill may contain different items we additional have a bills-Details table where all the items are listed.
    So you have costomers where each customer can have one up to 'n' bills and each bill can have one up to 'n' items. ( 'n' is meaning an undefined number )

    Whats with your samples ? A customer may give one order which contains different samples Isn't it ?
    This would need three tables then and the design of our form would be like

    customers Data in Textboxes-> Listbox or combobox for orders -
    Datagridview for samples.

    As better as you can define the scene as better the program will look, as easier it would be handled
    Attached Images Attached Images  
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  5. #35
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to show a form thru for next loop

    Whats with your samples ? A customer may give one order which contains different samples Isn't it ?
    This would need three tables then and the design of our form would be like
    For that, I'd use a flexgrid for the SAMPLES that relate to an ORDER, which relates to a CUSTOMER

    That grid could be a DYNAMICALLY generated query, that runs for each ORDER sent to it.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #36
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to show a form thru for next loop

    Quote Originally Posted by dglienna View Post
    For that, I'd use a flexgrid for the SAMPLES that relate to an ORDER, which relates to a CUSTOMER

    That grid could be a DYNAMICALLY generated query, that runs for each ORDER sent to it.
    Yes, but if you have to get the data depending on one specific customer then I would do it just the other way round as described or if its not to much you may have one Grid for all orders and all samles for each order, grouped by orders so he easily can see which orders contains whichsamples.
    But before we can do anything, we need to know whats his needs, which I'm just trying to find out.
    ---- edited ------
    dsrahul is reportNo a common thing for different samples ? so we have customers have reports and reports have samples ?
    Because your database IMHO still doesn't fit to second Normalform and third Normalform Please reread wikipedia with a look on this viewpoints
    Additional you'll find some changes I have remobved ADODC1 and done some small lines of code to show you how to bind the flexgrid to a recordset by use of a query. See Load_Form
    Sure I had to remove some of your other code which uses that ADODC1 but this I'll show you tomorrow. See attached
    Attached Files Attached Files
    Last edited by JonnyPoet; August 14th, 2009 at 07:56 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  7. #37
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    Exclamation Re: How to show a form thru for next loop

    Quote Originally Posted by JonnyPoet View Post
    Yes when the datasource is a query no problem.

    You simply need to code your word document. so it is correctly filled with data
    No this isn't the point, I'll learn you how to do this.:
    Answer:-
    In Word 2003 you can add form (Field) ,Double click that form & name it fldcustname & so on.
    but this can be done for 1 record if there are several (n number of ) data for the same customer
    How will I manage the unknown fields, because you can not create fieldFe/FieldAl2o3/Field SiO2 more than once they will be erased by word automatically.
    Now If I do like this FieldFe1/fieldAl2O31 etc etc VB frowns.
    I am adding one manually created Report with this & Please let me know.

    Quote Originally Posted by JonnyPoet View Post
    I dont understand you maybe a language problem.
    Generally Word or Excel can do whatever you want, Tables
    with lots of records, pagebreak and all that things:
    Answer:-
    If you take Datareport1 and try to populate with several samples for the same customer , it's beautifully done.
    but if you need to add a line on the top saying that The ReportNO(Leftjustified) is this and Labcode from 2000 - 2020 (Right justified) you have to put it in details section not on the page header.Now if you put it in the details section ,It shows 1 sample then again Reportno --- Labcode ,then on the next line again sample 2 then Report no--- Labcode
    then nextline again sample 3 like so on.



    Quote Originally Posted by JonnyPoet View Post
    There is absolutly no problem with what he wants, except the inner construction. A Customer like your boss is your customer and he can want what his needs are, but he can never do prescriptions of how the program works in its inner mechanics
    A unique key is BASIC BASIC for working with databases. How we will identify Mr Mayr, Boston in difference to Mr Mayr, Vienna without any unique key ? There are to much Jimmy's Johns and Peters on the world.:
    Answer:=
    He does not want to see the ID of the customer The customer will not be having any ID no
    he will be identified by name,what he told me,but AFAIK Database needs an ID number.

    Its usual, that the user is not involved in internal behaviour, so he may not see the unique key. But yu need to have one.
    Normally you have a searate form where you enter data and a form where you search your customer by his name. And if you find e.g. 10 persons named Smith the searching window will show you a list of all of them ( with additional data like adress phone no -- so on)
    so you can decide which Mr Smith you want to choose and this one and his sample records are shown in the Gridview then

    This is usual behaviour.
    Quote Originally Posted by JonnyPoet View Post
    I did not understand what a package is in your case and whats 'gaing' is, (cannot translate that, I know what gay means but I think thats not the translation
    Answer :-

    Package means this program.Let me be more specific.
    1)You switched on the stove then cooked rice, it was cooked properly.
    Now you know that you have to cook curry so you left the stove on started preparing for the curry,cooked curry then after cooking, you again remembered that you need to make scrambled eggs ,you cook the scrambled eggs and so on then at the end switch off the stove.
    2)You switch on the stove Cook Rice, Then switch off the Stove.
    Then again after sometime you switch on the stove ,cook Curry,Switch off the stove.
    once again you switch on stove cook scrambled egg, switch off the stove.like that.
    Here Stove =Computer with this Program
    Curry/Rice etc=Samples to be inputted.
    gaing is a typing mistake , I dont know why whenever I type 'again' gaing comes up. heheh
    Attached Files Attached Files
    Last edited by dsrahul; August 14th, 2009 at 01:31 AM.

  8. #38
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to show a form thru for next loop

    Quote Originally Posted by dsrahul View Post
    Answer:-
    In Word 2003 you can add form (Field) ,Double click that form & name it fldcustname & so on.
    but this can be done for 1 record if there are several (n number of ) data for the same customer how will....
    Sometimes people like to do easy things a bit complicated If you are coding what MS Word should do, using all the existing Word-classes like tables ... you can do everything you want. You do not need to add controls like a form field, no
    You simple calculate how many rows and cols you have, then dysnamically create a table on that form fill it with your data, then
    needed text, header and footer if needed, some pictures if you havn't already printed them on your companies paper, all you need can be done. Normally Reports and word docs are the last step in one design line. At first you need concept about
    a) what is to do
    b) databasedesign for all that needed purposes
    c) design of all needed forms - (textboxes, labels, grids, combos,buttons
    d) reports and printouts

    Answer:-
    If you take Datareport1 and try to populate with several samples for the same customer , it's beautifully done.
    but if you need to add a line on the top saying that The ReportNO(Leftjustified) is this and Labcode from 2000 - 2020 (Right justified) you have to put it in details section not on the page header.
    Definitly not. Why are you thinking that. ?
    He does not want to see the ID of the customer The customer will not be having any ID no, he will be identified by name,what he told me,but AFAIK Database needs an ID number.
    Thats totally normal. I already explained it in before ( you have obviously copied my answer )
    Its usual, that the user is not involved in internal behaviour, so he may not see the unique key. But yu need to have one.
    Normally you have a searate form where you enter data and a form where you search your customer by his name. And if you find e.g. 10 persons named Smith the searching window will show you a list of all of them ( with additional data like adress phone no -- so on)
    so you can decide which Mr Smith you want to choose and this one and his sample records are shown in the Gridview then

    This is usual behaviour. You click that one you want and this customer is used then. The user doesn't need to see any ID if he doesn't want.
    Package means this program....
    Ok understood.
    You open and close your datastream to the database everytime you need access to it. The program itself could be on the screen as long as you ever would like it. It will not terminate automatically, nor doing anything then waiting for any input to react. When you are looking to my example you will see that I removed ADODC1 and in the Form_load of your frmcust I bound an ADO recordset directly to your database. Thats much easier for your purposes as you will see. Did you get the idea ?
    BTW: Have you already worked with classes ?

    regarding Reports: Look at the attached picture I didn't do a great design here I'm only showing you where to add which fields All that fields that are related to one reopport to be the same are in the header, all data which depends to different rows of the dataset like samples are in the details
    just the same as your printout shows. Maybe prepare a report that way and I'll show you how to fill it
    Attached Images Attached Images  
    Last edited by JonnyPoet; August 14th, 2009 at 03:23 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  9. #39
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to show a form thru for next loop

    As I had a bit of time today I did some short changes in your code
    Look at how to delet a record, how to refresh grid, how to clear the grid from entries and how to reduce code by creating methods that are often used in your program. Also I changed the database as you see in the picture. I'm simple changing the file where I posted the code to a new file Intertek14Aug So please look for the zipfile in the earlier post #36. The picture shows the actual design of the database.
    Please look at it and tell me, which items in the Intertek table in reality contains one item for one report, so if any of the columns, which still remain in the intertek table, are to be removed there and added to the Report table, please do it. But dont forget if you do it to change the text in the mainQuery
    which is placed in Form_Load event. If questions feel free to ask or PM me ( its fine for me )
    Attached Images Attached Images  
    Last edited by JonnyPoet; August 14th, 2009 at 07:57 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  10. #40
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    Exclamation Re: How to show a form thru for next loop

    Dearest Pop.

    I have worked out on this Report thru Word. Remember there are two pages.
    I am attachingthe file for your perusal.
    This is the output which the client likes coz its editable after creation,saved in a specific folder.
    Retrieveable any point of time.
    Just keep it with you we'll be needing it after successfull completion of all these ADO/ADODC/Flexgid etc designs etc.
    Thereis an option in VB as Class. ( I felt it might be call1 class2 class 3 etc)
    But after a bit googling i knew it was something different , it seems a bit similar to dBaseIII
    DO CASE like thing,am I right?
    Anyway I am looking & learning the Rectified Program which you sent.
    I will get back as soon I understand what is what.
    Thanks Pop,
    Rahul.
    Attached Files Attached Files

  11. #41
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    Exclamation Re: How to show a form thru for next loop

    Dear Pop,

    I tried with your ADODB & recordsets.
    I have rectified some errors which were omitted from the Program, butI could not understand why the form irnor is not behaving properly to add new record.
    With rs
    .activeconnection(con)
    .open <---------- Error Comes here what wrong did I do?
    .Addnew
    Another thing a customer may have several LABCODE's but 1 ReportNo.
    In MShFlexgird , now its getting worse to hide the ID no.
    In Create Report It is partially filled up whereas it was filling everything before.Why?
    I am sending the .Zip again for your perusal.
    Thanks Pop.
    Rahul
    Attached Files Attached Files

  12. #42
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to show a form thru for next loop

    You have a big problem. A report isn't supposed to be editable. If they were to change data on the report, isn't it supposed to get back into the table?

    Looks like you need to either forget about using Word, and make forms for data entry, and reports. Or else, use Word, and bind the data to the form, and let the client edit the table directly
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  13. #43
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to show a form thru for next loop

    Quote Originally Posted by dsrahul View Post
    In MShFlexgird , now its getting worse to hide the ID no.
    I have totally removed the ID because in Table Intertek we can use LabCode as unique ID as much as I have seen ( I'm wrong ?? ) in your program every sample has a defined unique Labcode. So why using an additional unique key. This ID is useless IMHO
    In Create Report It is partially filled up whereas it was filling everything before.Why?
    The details section normally could be bound by field names the header section is bound by setting the values of that fields directly
    BTW I disike to be Pop, if you want to be short I'll like to be Poet or Jonny, but I dont know wht Popshould mean ?
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  14. #44
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to show a form thru for next loop

    Quote Originally Posted by dsrahul View Post
    Dear Pop,

    I tried with your ADODB & recordsets.
    I have rectified some errors which were omitted from the Program, butI could not understand why the form irnor is not behaving properly to add new record.
    Code:
    ' is the connection already opened here ???
    With rs
    .activeconnection(con)
    .open <---------- Error Comes here what wrong did I do?
    Yes sure you'll get an error which sql is opened at least you would need 'SELECT * FROM tablename

    But the connection needs to be already open. Also is defined if you open static or dynamic, optimistic, pessimistic ?
    Look how I opened the recordset in the Form_Load
    Code:
    Call rs.Open(strSQL, con, adOpenDynamic, adLockOptimistic)
    And BTW please dont forget always to use Code Tags
    Last edited by JonnyPoet; August 17th, 2009 at 02:45 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  15. #45
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to show a form thru for next loop

    Should open the table with SELECT * FROM xxx, but there is a problem when keys are involved.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Page 3 of 4 FirstFirst 1234 LastLast

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

Featured