Jump to content

bazzer747

Members
  • Content Count

    184
  • Joined

  • Last visited

Everything posted by bazzer747

  1. bazzer747

    GetLastAutoGenValue

    Works a treat, many thanks. Why can't the documentation be a little more helpful, especially as the guys who are looking this up won't know how to use it. Frustrated, but glad for this forum 🙂
  2. bazzer747

    RadioGroup Oddity

    Hi, I have a table which has an internal calculated field nHcap. It is a numeric field with values from 1 to 54. In the table I have another field which has a value of either 'Div 1', 'Div 2', or 'Div 3'. I use a RadioGroup with these three values available for selection, and when a selection is made I filter the table to show only records that have a certain nCap value. These values are 'Div 1' from 1 to 17, 'Div 2' from 14 to 21, and 'Div 3' from 20 to 54. The OnCLick event for the RadioGroup looks like this: procedure TfLadyMembers.rgDivsClick(Sender: TObject); var cChoice: String; begin dm.vMembers.Filtered:= False; //Start with clean slate cChoice:= rgDivs.Items[ rgDivs.ItemIndex ]; with dm.vMembers do begin if cChoice = 'Div 1' then Filter:= 'nHcap < 17'; if cChoice = 'Div 2' then Filter:= 'nHcap > 13 AND nHcap < 21'; if cChoice = 'Div 3' then Filter:= 'nHcap > 20'; Filtered:= True; end; if cChoice = 'All' then dm.vMembers.Filtered:= False; end; The problem I'm seeing is that when 'Div 1' is first clicked the filter gives incorrect records. Clicking the other buttons gives correct results, and subsequent clicks on 'Div 1' gives the correct results. I've traced the code in debug mode and the correct select/filtering is executed, so why am I getting incorrect records on the first selection. Very odd.
  3. bazzer747

    RadioGroup Oddity

    Just to finish this off, as no one has replied :-). I've changed from using Filter (as this fails with strange error conditions and incorrect results) to using SetRange, which works perfectly, and much quicker.
  4. bazzer747

    RadioGroup Oddity

    An extra 'oddity' is that when the first click on 'Div 1' produces the wrong set of records I sometimes get an error message to the effect a Bookmark is not found. I am not using Bookmarks so this is something internal.
  5. bazzer747

    RadioGroup Oddity

    An extra 'oddity' is that when the first click on 'Div 1' produces the wrong set of records I sometimes get an error message to the effect a Bookmark is not found. I am not using Bookmarks so this is something internal.
  6. bazzer747

    Startup Forms

    Hi When Delphi starts up an existing project, it shows some existing forms. I always thought it would show the forms that were in use when the project was last worked on. This isn't the case, as several forms are opened which haven't been worked on and have been closed down, yet still they are opened when that project is opened again. Where is this detail stored? I can only think in an ini file or the registry somewhere, but more important how can they be changed? Any thoughts would be appreciated.
  7. bazzer747

    Startup Forms

    Bill, HaHa, I struggle with lots of things that I could take for granted in earlier versions of Delphi like, as you, they always worked! Nowadays that isn't the case (in my experience). I have lots of problems with different areas of the IDE which I have to work around as they don't work as they should do. I've reported most of them but does anything get done - no, is my answer, and I've always updated to the latest Delphi (despite the ever increasing prices) partly in the hope that the 'known' issues will have been fixed.
  8. bazzer747

    Startup Forms

    Uwe, Thanks for that information. I've opened that .dsk file and can see thee 'unwelcomed' forms listed under [Modules]. Is it OK to delete them from here? Is this the best/safest way? I've also looked under tools/Options/User Interface, Reopen Menu - and under files can see these two unwanted forms (pas and dfm files) there, but with lots of other forms. Although the heading for this list says 'Reopen items' some do some don't. Is this where you can delete the unwanted .pas/.dfm files so they won't open despite the misleading heading?
  9. bazzer747

    Startup Forms

    Bill, I've found what you say not to be the case. On several occasions I've closed those 'unwanted' forms, opened and saved several other forms, then properly closed Delphi, saving any changes necessary and yet when I bring Delphi up again there are those two unwanted forms and not the forms that were opened when last used, other than the Main form and a data module (these two are in my 'Auto-create forms' list rather than 'Available forms' (which hold all the other forms in the project.
  10. bazzer747

    Startup Forms

    Uwe, Thanks for that information. I've opened that .dsk file and can see thee 'unwelcomed' forms listed under [Modules]. Is it OK to delete them from here? Is this the best/safest way? I've also looked under tools/Options/User Interface, Reopen Menu - and under files can see these two unwanted forms (pas and dfm files) there, but with lots of other forms. Although the heading for this list says 'Reopen items' some do some don't. Is this where you can delete the unwanted .pas/.dfm files so they won't open despite the misleading heading?
  11. I had a similar error with a type mismatch with a date field in MSSQL, due to a new data type being introduced that wasn't recognised by the driver. Found the new driver and all was well.
  12. Hi, When I open my project I cycle through all the queries I use making sure they are all active, this works fine. Depending on what year I want to view I have a radio box with '2019' and '2020' as selections and from that I need to 'filter' the data to only show the year chosen., I load the value into cYear. So I have this line: qQueryname.Open( 'SELECT * FROM tTablename WHERE mYear = :pY ORDER BY eDate',[ cYear ] ); When this line is executed I get the error message above on this query, which is confusing me as it is an 'Open' command. The weirder thing is that the SQL is executed OK and the resulting data is the correct year's data. Using: Filtered:= False; Filter:= 'MatchYear = ' + cYear; Filtered:= True; code instead works perfectly with no issues.
  13. bazzer747

    Cannot perform this operation on a closed dataset

    Hi, Thanks for this, I've got monitoring working OK now. Although there is so much information it takes ages to find what I need. I'll play with the controls to try to restrict this output to just what I need to look at. Many thanks for the lesson. And Dany, thanks for the info. All very useful.
  14. bazzer747

    Cannot perform this operation on a closed dataset

    Hi, Interesting suggestion, use the FireDac Monitor. I've never used that, never thought about this either, didn't know it existed even! I've checked the documentation about it and like a lot of Embarcadero documentation it rarely thinks the reader is a novice and doesn't give clear instructions. I've grappled by, but cannot get any output into the monitor, nor can I see any output using FDQuery.Text, so somewhere I haven't set a value or checked a box. I'll carry on searching/testing etc. as it seems like a very useful tool. A suggestion above said to close the query first before opening it and this has worked, so another confusing event here - it cannot work on a closed dataset but after closing it it will open. Who or what closes a dataset? Nothing I do in the application specifically closes any dataset. Many times I respecify the query to change parameters but never knowingly close it.
  15. bazzer747

    Cannot perform this operation on a closed dataset

    Dany, I meant no disrespect with my words, often they don't convey meaning very well. I did thank you for replying and am trying the other ways you mentioned. The documentation with Firedac, whilst extensive, is very poor at 'practical solutions' and error diagnosis. I have Cary Jenson's Delphi in Depth: FireDac (about the only one there is about Firedac) and again this doesn't cover the issues I'm having, so reading the manual isn't helping, hence my question on the forum.
  16. bazzer747

    Cannot perform this operation on a closed dataset

    Vandrovnik, Not doing Master-Detail, and this occurs in the FormActivate so the first time the query is accessed other than when it is opened when the application starts.
  17. bazzer747

    Cannot perform this operation on a closed dataset

    Attila, Did that but I'm no wiser, I'm not that versed in the deeper Delphi layers. What/how would I trace what the 'real' problem is?
  18. bazzer747

    Cannot perform this operation on a closed dataset

    That doesn't work - I get the same message when it tries to run aQueryname.Close I'm using Firedac for these commands, I've used this shorthand version of opening a query with a new SQL many times with no problem. Just annoying the error message is so unhelpful, almost saying you can't open this until you open it! The old fashioned filtering works fine; I'll try the param setting in the query and see if that works better. Thanks for replying.
  19. bazzer747

    How to Code SQL IN Statement correctly

    Many thanks, I have this code working fine now: qQuery.Open( 'SELECT * FROM tTableName WHERE Status IN ( :pS, :pR ) ORDER BY EventDate', [ 'S', 'R' ] ); Good to know there is a way ...
  20. The MS SQL ODBC driver 17 seems to requires other libraries to be installed.
  21. bazzer747

    Component already exists

    Hi I've created a new Windows VCL application and on the first form I've added several buttons, each buttons click event opens a new form. Three of these forms are OK, I've added various components (buttons, navigators, grids etc) but on the last I opened has no components on it except a button (called btnClose) which simply closes the form. However, when I run the application and press the button that opens this form I get an error message: 'A component named btnClose already exists'. After selecting the OK to this error, if I click the same button again the application freezes and I use Task Manager to kill it. If I click the other buttons, they open their forms fine, but if I then click on the 4th one again I get 'Invalid pointer operation'. This is the form in text: object fViewSignups: TfViewSignups Left = 0 Top = 0 Caption = 'View Signups' ClientHeight = 299 ClientWidth = 678 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object btnClose: TRzButton Left = 520 Top = 40 Caption = 'Close' TabOrder = 0 OnClick = btnCloseClick end end ... no duplicate btnClose, also see attached screenshot. I created this form with: procedure TfMain.RzButton2Click(Sender: TObject); begin fViewSignups.Create( Self ); try fViewSignups.Showmodal; finally fViewSignups.Free; end; end; Which is identical to the way I created the other 3 forms which all work OK. I've closed everthing down and restarted everything and can't think of anythging else to look at to see where or why this error is happening. This is the first Windows application I've created since upgrading to Delphi 10.3.3, which may be something. Any thoughts on what else I can do would be appreciated.
  22. bazzer747

    MSSQL Busy

    A client has several of the applications I've written over the past several years and all work OK, They all connect (with FireDac) to a Microsoft SQL Server. However, I've just loaded a newer application (compiled in Delphi 10.3.3) and when I run it on this PC I get the following FireDac error message immediately (see attached): Exception EMSSQLNativeException in module ... at ..... [FireDAC][Phys][ODBC][Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt The PC is not running any other application that could be accessing the MS SQL Server, so I'm at a loss as to why it is busy at all. This application works fine on my development machine. Would this be a driver issue, maybe a newer driver is needed (is there one)? Or does Delphi 10.3.3/FireDAC do something differently to what it did in earlier versions? Any thoughts would be much appreciated.
  23. bazzer747

    Component already exists

    Arrgghhh! I've spotted the error. In the code I had fViewSignups.Create( Self ); Should be: fViewSignups:= tfViewSignups.Create( Self ); Silly type error, can't see the woods for the trees sometimes ... Works fine now.
  24. bazzer747

    Master-Detail Example

    Does anybody know where I can find a (simple) example of setting up a Master-Detail on two tables (MSSQL in my case)? All I can find via the internet are either overly complicated examples or in non-English languages. The Help in Delphi/Firedac is the former and very difficult to follow.
  25. bazzer747

    Master-Detail Example

    Many thanks, thought this was just a data question rather than specific to FireDac, but noted for next time ...
×