Search results

  1. J

    issue with extracting portion of name with access query

    Thanks for response.
  2. J

    issue with extracting portion of name with access query

    Hey all, There's a problem with this query: SELECT p.aname INTO GenericForgottenWithoutInitial FROM (SELECT Left([TheName],IIf(InStrRev([TheName]," ")>1, InStrRev([TheName]," ")-1,Len([TheName]))) AS aname FROM TheForgotten) AS p; Basically I am trying to extract away a middle initial (or...
  3. J

    if field has two spaces pull content to the left of second space

    Hey all, I have this query: SELECT p.aname INTO GenericForgottenWithoutInitial FROM (SELECT Left([TheName],IIf(InStrRev([TheName]," ")>1, InStrRev([TheName]," ")-1,Len([TheName]))) AS aname FROM TheForgotten) AS p; Problem is it pulls content to left of first space because of this part...
  4. J

    Changing the text value of legends

    Hey all, I found it surprisingly difficult to change the text value of legends when creating a chart on a report. I read in another forum that you have to alter Row Source in Property Sheet. The thing is the Row Source just contains a query: SELECT [mailer_states_id],Count(*) AS [Count] FROM...
  5. J

    Syntax error in query expression 'SELECT update_mailer_step_two.id FROM...

    I tried using INNER JOIN but while this produces no error, it appends 0 rows, presumably because there is no INNER JOIN link between update_mailer_step_two and mailer_states: INSERT INTO mailers ( contacts_first_filter_id, mailer_states_id, created_at ) SELECT update_mailer_step_two.id...
  6. J

    Syntax error in query expression 'SELECT update_mailer_step_two.id FROM...

    Thanks for response. This is not a single row insert. I want it to go the length of update_mailer_step_two table, so if there are 20 records in update_mailer_step_two table, then 20 records will be created in mailers, each having the current time, a mailer_state of 'sent', and whatever the...
  7. J

    Syntax error in query expression 'SELECT update_mailer_step_two.id FROM...

    Thanks for response. I'm not sure how to set variables in Access. I try this in VBA but when clicking button it displays a popup telling me "Query input must contain at least one table or query": Private Sub Command6_Click() Dim CFF_ID As String, MS_ID As String, strSQL As String...
  8. J

    Syntax error in query expression 'SELECT update_mailer_step_two.id FROM...

    I try this: INSERT INTO mailers ( contacts_first_filter_id, mailer_states_id, created_at ) VALUES ((SELECT update_mailer_step_two.id FROM update_mailer_step_two), (SELECT mailer_states.id FROM mailer_states WHERE mailer_states.mailer_state = 'sent'), Now()); and get the error: 'Query input...
  9. J

    Syntax error in query expression 'SELECT update_mailer_step_two.id FROM...

    What I think the problem is is that you can't use VALUES and SELECT like that. But I don't know another way around it to place the values from the record in one table, while giving default values as well.
  10. J

    Syntax error in query expression 'SELECT update_mailer_step_two.id FROM...

    I get the above error with this query: INSERT INTO mailers ( contacts_first_filter_id, mailer_states_id, created_at ) VALUES (SELECT update_mailer_step_two.id FROM update_mailer_step_two, 1, Now()); I'm not only trying to pull data from another table and insert it into one, but I'm also trying...
  11. J

    nested joins to update one table based on the comparison between two other tables

    This doesn't work either: UPDATE mailers SET mailers.contacts_first_filter_id = contacts_first_filer.id FROM mailers INNER JOIN contacts_first_filer, UpdateQuery ON contacts_first_filer.addresses = UpDateQuery.Address, contacts_first_filer.cities = UpDateQuery.City...
  12. J

    nested joins to update one table based on the comparison between two other tables

    This still gives same syntax error: UPDATE mailers AS m INNER JOIN (UpdateQuery INNER JOIN contacts_first_filter ON UpDateQuery.Address = contacts_first_filter.addresses AND UpdateQuery.City = contacts_first_filter.cities AND UpdateQuery.Zip = contacts_first_filter.zip_code ) SET...
  13. J

    nested joins to update one table based on the comparison between two other tables

    Thanks for response. A where clause for where?
  14. J

    nested joins to update one table based on the comparison between two other tables

    Hey all, I have a table called mailers which I want to update the mailer_states_id with a user required input and update contacts_first_filter_id field with the id of the contact from the contacts_first_filter table whose address, city, and zip code (in the contacts_first_filter table) is equal...
  15. J

    running queries one after another

    Thanks for response. What does that do and how is that any different from what I already have?
  16. J

    running queries one after another

    I tried the msgbox already but doesn't work: Public Function initializeFirstSet() DoCmd.SetWarnings False 'Drop table if exists On Error Resume Next DoCmd.RunSQL "DROP TABLE defense_final" DoCmd.RunSQL "DROP TABLE duplicatecheck" 'Otherwise we now just execute queries DoCmd.OpenQuery...
  17. J

    running queries one after another

    Thanks for all your responses. The easiest thing for me to do that seemed to work is create a button and have this vb: Public Function initializeFirstSet() DoCmd.SetWarnings False DoCmd.OpenQuery "defense_query" DoCmd.OpenQuery "CREATE possibles" DoCmd.OpenQuery "APPEND to possibles"...
  18. J

    running queries one after another

    Ok Im now trying to add it to button. I think it might hvae worked.
  19. J

    running queries one after another

    Is there a way to make this easy? Stick visual basic code in a module and then double click the module and have the queries run in sequence? I'm not looking to have a nice looking form or anything. I just want to double click something so the queries run.
  20. J

    running queries one after another

    I also tried to create a button and then try miscellanous > run query but it only lets me run 1 query.
Top Bottom