![]() Set qdf = CurrentDb.CreateQueryDef("qryDummy", strSQL)ĭoCmd.OpenQuery "qryDummy", acViewNormal, acReadOnlyĭoCmd.Maximize ' Maximizes the Query Results pane StrSQL = "Select FName, LName, CustPhone, CustAddress from tblCustomers" ' If the query is closed it can be deleted 'Must Close the Open query if such the caseĭoCmd.Close acQuery, "qryDummy", acSaveNo (By the way, it turned out the meeting's actually not for another half hour.) If the former, then I assume it would be better to set the other properties first, correct?.Is the SQL executed immediately when RowSource is set, or when the display is refreshed?.It must be the actual numeric value (for Excel to work with), but preferably formatted into hours, minutes etc.Īlso, a question or two come to mind. Is there any way I could set a date/time field to show a particular format? You see, it's not good enough to simply display the formatted string.Would a multi-column listbox work for this? I need the user to be able to copy this output and paste it to Excel.However, I forsee a couple of problems, based on things which I haven't mentioned yet (at least in this thread). I haven't had enough of a chance to play with the various form controls in Access, anyway, so it'll be fun. One other option which I've used in the past where users only needed to view results is using a listbox. Set qry = CurrentDB.QueryDefs("QueryName") Rather than creating the new querydef from scratch each time, have a query template with appropriate formatting, which is then copied and the SQL modified each time.That is, things like column width and for a couple of time fields, a Format of “hh:nn:ss” (that may be out of date – I need to look up what was suggested on theScripts when I asked about this some time back). Look through the field definitions after creating the querydef, and see whether I can set various properties accordingly.But the formatting of the result is not really acceptable. This all work OK, and performance is quite nice. It then uses CreateQueryDef to create a new query in the database, then OpenQuery to open it. #ALL FOR STRINGS THEORY WORKBOOK 2 PAGE 28 31 CODE#The VBA code builds the SQL string which will query the various tables and UNION the results. You see, I have my big multi-database query thing working nicely. Lunch time now, so I can spare a few minutes to throw in a question before my 2 hour meeting.Ĭan someone show me briefly how, from VBA, to set up a query with columns formatted the way I want? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |