22. november 2004 - 10:51Der er
28 kommentarer og 2 løsninger
Forskellige udtræk i combobox
Jeg har en tabel, navn: TBL tarmtekst .. hvori der er:
Tarmnr: tal Tarmtekst: String fod: tal
Jeg har en formular med en combobox med rækkekildetype: Værdiliste
I denne combobox skal jeg taste et varenr på 8 tegn ( numerisk ). -> denne del er løst! Jeg vil have at når jeg taster en del af en varenr. fx 2030 . Så skal access 2000 med VB kode: tage et udtræk på 2030* i "TBL Tarmtekst", og add det til comboboxen. Comboboxen skal clears hver gang man sletter eller taster noget af varenr.
//dl
hvordan kan jeg lave det .... jeg er ikke newbie i access 2000, men er ikke god. har lært alt det jeg kan i delphi ( pascal ).
jeg har en masse kode, på sql udtræk osv. men kan sku ikke få det til at virke som jeg vil.
Det skal lige siges at dette program IKKE vil blive udgiver på nogle måde. det er kun for at jeg kan lære access 2000.
I et inbound callcenter, hvor identiteten på den, der ringer ind, skal bekræftes, kan kontrollen nu foregå i telefonkøen. Det understøtter fem centrale KPI'er for callcentre.
Normally you enter text in the text field of the combo to find an entry in the listbox part of the combo. I dont see ant reason as to why you want to change the contents of the combo when you enter a value in the text field of the combo.
Ret Tabel3 til din tabel ret [nr] til dit felt i tabellen din kombo skal have data fra
Private Sub Tarmnr_Change() Dim L As Integer If Not IsNull(Len(Tarmnr)) Then L = Len(Tarmnr) Tarmnr.RowSource = "SELECT [nr] FROM Tabel3 WHERE left([nr]," & L & ")= " & Tarmnr End If Me.Recalc Me.Refresh Tarmnr.SelStart = L + 1 End Sub
terry >> hvis jeg indtaster 40506 jeg skal lave opslag på 40506* i alle værdier i min tabel og sætte dem in i comboboxen. Hvis jeg ændre noget i combobox, så skal jeg køre hele proceduren igen.
k, jeg laver en indtastning , så skal jeg lave et opslag på minindtastning* ... fx 40506*
så søger jeg min data igemmen
405060 - Valid , fordi den MATCH'er min indtastning + * (windcard) 41506000 - NOT Valid, no MATCH! char 2 from left, does not math my input. char 2 = "1" my is 0 50606000 - NOT Valid 60503400 - NOT Valid 40506900 - Valid
Alt hvad er der Valid skal vises i combobox.
//dl
PS. jeg undskylder... jeg forklare som en gang shit.
kabbak >> dit eksempel er ikke helt som det skal. når jeg indtaster en værdi som findes ... så indtaster den i combobox "SELECT [nr] FROM Tabel3 WHERE left([nr]," & L & ")= " & Tarmnr" altså den køre ikke din sql sætning ... eller var det også noget jeg selv skulle rette til.
In the combo box On Change event palce code something like this
Me.VareNr.RowSource = "SELECT * FROM TBL tarmtekst WHERE Tarmnr LIKE '" & Me.YourCombo & "*' ORDER BY VareNr"
You also need to alter the combo's "Auto Expand" to NO otherwise the txt field gets filled out with th efirst entry it finds in the list matching what you enter.
In this example the list will change for ALL characters you enter.
Jeg få en error: complete error: Medtod or data menber not found.
jeg har prøvet med: Dim L As Integer If Not IsNull(Len(Tarmnr)) Then L = Len(Tarmnr) Me.Varenr.RowSource = "SELECT * FROM TBL tarmtekst WHERE Tarmnr LIKE '" & Me.Tarmnr & "*' ORDER BY VareNr" End If Me.Recalc Me.Refresh Tarmnr.SelStart = L + 1
OG denne kode:
Dim L As Integer If Not IsNull(Len(Tarmnr)) Then L = Len(Tarmnr) Me.Varenr.RowSource = "SELECT * FROM [TBL tarmtekst] WHERE Tarmnr LIKE '" & Me.Tarmnr & "*' ORDER BY VareNr" End If Me.Recalc Me.Refresh Tarmnr.SelStart = L + 1
Hi dl you set the column count to the number of columns you want. Then youus ethe column widths to tell how wide each column is to be 0 means not visible.
You should try using the wizard and you will get an idea.
Normally you wouldnt change the data in the combo. Once you have selected a record from the combo, then the data gets placed in the database. Now if you go changing the entries, the one in the database may not exist in the list. It would normally be a soretd list and when you start entering data the text changes to one in the list.
hvad betyder denne linie ... Me.Tarmnr.RowSource is where you tell the combo to get its data. In this case it is comming from a SQL "SELECT....." it could be a table or query.
Yes thats all the code I used. But you also have to change the "Auto Expand" to No.
:o) They are part of the SQL language. You should maybe get a book on SQL as it would take me a long time to tell you
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.