Results 1 to 5 of 5
  1. #1
    tzhgare1 is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Location
    Switzerland
    Posts
    5

    Programice a query automaticaly

    If I write this query then is function (db.CreateQueryDef("QueryName", SELECT * From nachname Where nachname like 'A*'")



    But I dont know how to configure this 'A*' automaticly. If I am in the database at in one of a record would have this Nachname at this position 'A*' automaticly. Because i wouldent change this manuel.

    Can someone helping me?
    Thanks

  2. #2
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349


    Can you post the code block where you creating/updating the stored query? Without seeing that, if the code is executing within the form where there is a Control named txtNachName, then: "SELECT * From nachname Where nachname like '" & Me.NachName & "*'"

  3. #3
    tzhgare1 is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Location
    Switzerland
    Posts
    5
    Private Sub Kombinationsfeld176_BeforeUpdate(Cancel As Integer)
    Dim db As Database
    Dim qd As QueryDef
    Set db = CurrentDb()
    Dim Wert1 As String

    Wert1 = Nachname

    Set qd = db.CreateQueryDef("Abfrage1", "SELECT [A_Tarif_KK].[Nachname], [A_Tarif_KK].[KKName], [A_Tarif_KK].[Positionsnummer] FROM [A_Tarif_KK] WHERE Nachname LIKE Wert1")

    End Sub

  4. #4
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    In line "Wert1 = Nachname", what is Nachname? A Control?

    If so, then:
    Set qd = db.CreateQueryDef("Abfrage1", "SELECT [A_Tarif_KK].[Nachname], [A_Tarif_KK].[KKName], [A_Tarif_KK].[Positionsnummer] FROM [A_Tarif_KK] WHERE Nachname LIKE '" & Me.Nachname & "*'")

  5. #5
    tzhgare1 is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Location
    Switzerland
    Posts
    5
    Thanks I had do. Now is working.
    Wish you a good day

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access 2000-data automaticaly deleting
    By bobykuriakose12 in forum Access
    Replies: 4
    Last Post: 08-13-2013, 11:24 PM
  2. Replies: 0
    Last Post: 11-22-2011, 09:22 PM
  3. Automaticaly checking a check box
    By brandonze in forum Forms
    Replies: 9
    Last Post: 07-07-2011, 08:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums