Search results

  1. J

    SQL syntax issues for VBA

    Thanks for your help. The following code works (somebody showed it to me on another board) Dim strSQL As StringDim strTbl As String strTbl = "myusertable" strSQL = "SELECT " & Me.RecordSource & ".* INTO " & strTbl & " FROM " & Me.RecordSource docmd.SetWarnings False...
  2. J

    SQL syntax issues for VBA

    Yeah sorry, I forgot the quotes in this post (they are there in the application) just because I cut and pasted without the "ORDER BY" section because it was irrelevant. I've tried this with or without the semilcolon and it still doesn't work. I don't think the semicolon is actually required...
  3. J

    SQL syntax issues for VBA

    I changed all my query Object variable names to qdf and still had the same error :confused:
  4. J

    SQL syntax issues for VBA

    The following code works fine because I explicitly reference "[Forms]![Main Page]![Program]" strSQL = "SELECT * INTO " & strUserTableName & " FROM [Current] WHERE [Program] = '" & [Forms]![Main Page]![Program] & "'" The PROBLEM is that I actually want to define a make-table query based on my...
  5. J

    Creating table based on a query

    Hi Bob, Even tried execution directly from the "Main Page" form which isn't pop-up OR modal and the same problem occurred :(
  6. J

    Creating table based on a query

    Hi Bob, I seem to be having a little trouble with the make-table query. I have the following three queries: 1. SELECT [Current].[NCR Number], [Current].[Line Stopper?], [Current].[Date Required], [Current].[Date Raised] FROM [Current] WHERE ((([Current].Location)="Some Location")); 2...
  7. J

    Creating table based on a query

    Sorry, what I meant was that if the recordSource of the form and the rowSource of a control of the form are based on a query, and you set add/edit/delete to false, then does that mean that neither will change until I reset the add/edit/delete properties to true? Just tested it and setting those...
  8. J

    Creating table based on a query

    Thanks! Now that I think about it, I may have been a little overzealous. Under what conditions would the recordSource requery anyway? I only open the form as a pop-up from the main menu (where it inherits the recordSource) , I don't open any other forms, and just want the recordSource to...
  9. J

    Excel Problem

    Just to confirm, should Excel.Application.UserControl = True only be called when exiting on error? It's just that if I place it in the actual code that seems to CAUSE problems rather than fix any (if a successful exit and I try to enter excel file after changing UserControl only Excel tool/menu...
  10. J

    Creating table based on a query

    Hi, I'm exporting the recordSource of a form to Excel. The recordsource itself is a query but I'd like it to remain unchanged the whole time I have the form open (so that it mirrors the data that I export to excel). So ideally I would like to be able to create a table based on the...
  11. J

    Public functions within a form module

    Sorry! Actually guys. All of those suggestions work... I've been changing stuff around so much (and putting things in and out of separate modules) that I forgot to return the function to public... :rolleyes: You'd think the errors would be more descriptive! ;)
  12. J

    Public functions within a form module

    Hey Tim, I tried the following: Dim testForm As Form Set testForm = [Forms]![Edit NCR] Call testForm.NCR_Selection_Click and it returned runtime error 2465: "Application-defined or object-defined error" I'm lost!
  13. J

    Public functions within a form module

    Actually, now that I think about it... I thought it was working but just realised that Access doesn't seem to like what I am doing. When I try: Call [Forms]![Edit NCR].NCR_Selection_Click() I get a syntax error on the '!'. Says: expecting a '.' or a '('. So then (just for the craic)...
  14. J

    Public functions within a form module

    All good now Thanks! :)
  15. J

    Public functions within a form module

    Hi all, I am now in the practise of placing all of my public functions where possible in a separate module but if you wanted, could you declare public functions within a particular form (I realise that the form would probably have to be open when calling the function)? It doesn't seem to work...
  16. J

    dynamic SQL using current RecordSource

    BTW I also found that I don't even need to put in the record source! i.e.: strSQL = "SELECT [ID Number], [Field1] FROM [" & strSource & "];"
  17. J

    dynamic SQL using current RecordSource

    Hi, The following works for me: strSQL = "SELECT * FROM [" & Me.RecordSource & "]" but when I try to select certain fields from the recordSource, it doesn't seem to work. This is one of my failed attempts: strSQL = "SELECT [" & Me.RecordSource.[ID Number] & "],[" &...
  18. J

    Trouble updating linked Excel chart (unbound object in form)

    Just to further describe the problem, I am trying to automate the updating of my unbound object. I have tried setting the object properties 'automatic update' and in tools->options->advanced, set refresh interval to 1 second but the only time it ever updates is if I double-click on it. I...
  19. J

    Trouble updating linked Excel chart (unbound object in form)

    Hi, I have a form "EXPORT FORM" that displays individual records and some statistics regarding them. On the same form, I also have an unbound object which is linked to a Microsoft Excel Chart. I have my own 'next record' and 'previous record' buttons. When either of these are pressed, I open...
Back
Top Bottom