From: Co on 11 Aug 2010 14:38 On 11 aug, 14:29, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com> wrote: > "Co" <vonclausow...(a)gmail.com> wrote in message > > news:fcb34e27-9ff0-43d2-9838-85ce3e67ce25(a)z10g2000yqb.googlegroups.com... > > > > > On 11 aug, 13:08, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com> > > wrote: > >> "Co" <vonclausow...(a)gmail.com> wrote in message > > >>news:8aa6c107-53e6-470b-9deb-562166f79eeb(a)y11g2000yqm.googlegroups.com... > >> On 11 aug, 12:36, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com> > >> wrote: > > >> > "Co" <vonclausow...(a)gmail.com> wrote in message > > >> >news:7224e501-64a9-4eaa-9d4d-8e4c590bbdc2(a)e15g2000yqo.googlegroups.com... > >> > On 11 aug, 11:23, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com> > >> > wrote: > > >> > > Try DoCmd.RunCommand acCmdSelectRecord in the continuous form's On > >> > > Activate > >> > > event. > > >> > > Jon > > >> > > "Co" <vonclausow...(a)gmail.com> wrote in message > > >> > >news:ae7efe9d-6f65-4427-b527-b372fdb05035(a)y11g2000yqm.googlegroups.com... > > >> > > > Hi All, > > >> > > > I know there are so many questions on this issue but mine is just a > >> > > > little different. > >> > > > What I am trying to establish is the following: > >> > > > The user clicks Alt-Q which opens a form with a listbox with years > >> > > > on > >> > > > it. > >> > > > When he chooses a year the form closes and in my continious form it > >> > > > jumps to the > >> > > > first record of that year. Now the little arrow in the > >> > > > recordselector > >> > > > shows which record > >> > > > it is but I would like to have the whole record highlighted (like > >> > > > when > >> > > > you click with the > >> > > > mouse on the recordselector). > >> > > > How can I simulate the mouse click or highlight the record for that > >> > > > matter? > > >> > > > My code: > > >> > > > Private Sub Keuzelijst1_AfterUpdate() > > >> > > > Dim int1 As Integer > >> > > > Dim str1 As String > >> > > > Dim lngTop As Long > > >> > > > int1 = 4 > >> > > > str1 = "Left([BriefNr]," & int1 & ")" > > >> > > > varJaar = Keuzelijst1.value > > >> > > > With Forms!FrmTabelTotaal!subFrmTabelTotaal.Form > >> > > > lngTop = .SelTop > >> > > > .RecordsetClone.FindLast (str1 & " = '" & varJaar & "'") > >> > > > .SelTop = lngTop > >> > > > If Not .RecordsetClone.NoMatch Then > >> > > > .Bookmark = .RecordsetClone.Bookmark > >> > > > End If > >> > > > .Form_Click > > >> > > > End With > >> > > > DoCmd.Close acForm, Me.Name, acSaveNo > > >> > > > End Sub > > >> > > > Regards > >> > > > Marco > >> > > > The Netherlands- Tekst uit oorspronkelijk bericht niet weergeven - > > >> > > - Tekst uit oorspronkelijk bericht weergeven - > > >> > Jon thanks for the response. > > >> > There are two things. The form I use is not a continious one its > >> > actually Datasheet, my mistake. > >> > I put the code in the Current event because the On Active didn't work. > > >> > It does highlight the record now but when I try to scroll through the > >> > records the highlight dissapears. > > >> > Marco > > >> > I've just tested this in the Current Event on a Datasheet and it seems > >> > to > >> > work fine. How are you scrolling through the records? I'm pressing the > >> > Down Arrow and am getting each row highlighted as if a was pressing the > >> > Record Selector. Maybe you have other code executing affecting this? > > >> > Jon- Tekst uit oorspronkelijk bericht niet weergeven - > > >> > - Tekst uit oorspronkelijk bericht weergeven - > > >> I have a conditional formatting on a deadline field it checks the > >> date. > >> Maybe that's causing it highlight to dissapear. > > >> Marco > > >> Maybe - temporarily remove it and check. > > >> Jon- Tekst uit oorspronkelijk bericht niet weergeven - > > >> - Tekst uit oorspronkelijk bericht weergeven - > > > That doesn't change anything. > > > MArco > > I would suggest that you create a new Datasheet form based on an existing > table and put DoCmd.RunCommand acCmdSelectRecord in its Current Event just > to prove that it works in your version/SP of Access, then examine the > differences in your real scenario to find out what the problem is. > > Jon I got it working in a new form, don't why it doesn't work in an existing form... How should I use this? MArco
From: Salad on 11 Aug 2010 15:34 Co wrote: > On 11 aug, 18:39, Salad <sa...(a)oilandvinegar.com> wrote: > >>Co wrote: >> >>>Jon thanks for the response. >> >>>There are two things. The form I use is not a continious one its >>>actually Datasheet, my mistake. >>>I put the code in the Current event because the On Active didn't work. >> >>>It does highlight the record now but when I try to scroll through the >>>records the highlight dissapears. >> >>>Marco >> >>I created a Datasheet form. In the header, I dropped in a text box and >>named it NewID. When opened, the textbox does not appear in the header. >> >>In the OnCurrent event I entered >> Me.NewID = Me.ID 'ID is the table id name >> >>Then I set conditional formatting on the ID field (it's not hidden). >>FieldValueIs EqualTo [NewID] and set some color. >> >>Opened/ran. Does the trick. But doesn't maintain the color. >> >>So maybe when you Alt-Q, set NewID to the value if when first year >>record is found. You could use a DblClick event to set NewID as well >>while in the form. > > > I am very curious how you do this because when I place the textbox in > the header > and call it NewID the form doesn't recognize it. > > Marco I don't know if I did anything special. I went the form wizard, selected a table, selected a few fields, selected type Datasheet, selected I wanted to modify it first b4 viewing, dragged the detail bar down so I could drop in a textbox in the FormHeader band, and did so. This is A2003. This capability was available in A97. This is also a form with default type of Datasheet presentation. I assume that is what you have since you mentioned you did conditional formatting on it elsewhere.
From: Jon Lewis on 12 Aug 2010 09:30 "Co" <vonclausowitz(a)gmail.com> wrote in message news:e1e6646d-c050-4985-8f06-46d5d05881a2(a)z10g2000yqb.googlegroups.com... > On 11 aug, 14:29, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com> > wrote: >> "Co" <vonclausow...(a)gmail.com> wrote in message >> >> news:fcb34e27-9ff0-43d2-9838-85ce3e67ce25(a)z10g2000yqb.googlegroups.com... >> >> >> >> > On 11 aug, 13:08, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com> >> > wrote: >> >> "Co" <vonclausow...(a)gmail.com> wrote in message >> >> >>news:8aa6c107-53e6-470b-9deb-562166f79eeb(a)y11g2000yqm.googlegroups.com... >> >> On 11 aug, 12:36, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com> >> >> wrote: >> >> >> > "Co" <vonclausow...(a)gmail.com> wrote in message >> >> >> >news:7224e501-64a9-4eaa-9d4d-8e4c590bbdc2(a)e15g2000yqo.googlegroups.com... >> >> > On 11 aug, 11:23, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com> >> >> > wrote: >> >> >> > > Try DoCmd.RunCommand acCmdSelectRecord in the continuous form's On >> >> > > Activate >> >> > > event. >> >> >> > > Jon >> >> >> > > "Co" <vonclausow...(a)gmail.com> wrote in message >> >> >> > >news:ae7efe9d-6f65-4427-b527-b372fdb05035(a)y11g2000yqm.googlegroups.com... >> >> >> > > > Hi All, >> >> >> > > > I know there are so many questions on this issue but mine is >> >> > > > just a >> >> > > > little different. >> >> > > > What I am trying to establish is the following: >> >> > > > The user clicks Alt-Q which opens a form with a listbox with >> >> > > > years >> >> > > > on >> >> > > > it. >> >> > > > When he chooses a year the form closes and in my continious form >> >> > > > it >> >> > > > jumps to the >> >> > > > first record of that year. Now the little arrow in the >> >> > > > recordselector >> >> > > > shows which record >> >> > > > it is but I would like to have the whole record highlighted >> >> > > > (like >> >> > > > when >> >> > > > you click with the >> >> > > > mouse on the recordselector). >> >> > > > How can I simulate the mouse click or highlight the record for >> >> > > > that >> >> > > > matter? >> >> >> > > > My code: >> >> >> > > > Private Sub Keuzelijst1_AfterUpdate() >> >> >> > > > Dim int1 As Integer >> >> > > > Dim str1 As String >> >> > > > Dim lngTop As Long >> >> >> > > > int1 = 4 >> >> > > > str1 = "Left([BriefNr]," & int1 & ")" >> >> >> > > > varJaar = Keuzelijst1.value >> >> >> > > > With Forms!FrmTabelTotaal!subFrmTabelTotaal.Form >> >> > > > lngTop = .SelTop >> >> > > > .RecordsetClone.FindLast (str1 & " = '" & varJaar & "'") >> >> > > > .SelTop = lngTop >> >> > > > If Not .RecordsetClone.NoMatch Then >> >> > > > .Bookmark = .RecordsetClone.Bookmark >> >> > > > End If >> >> > > > .Form_Click >> >> >> > > > End With >> >> > > > DoCmd.Close acForm, Me.Name, acSaveNo >> >> >> > > > End Sub >> >> >> > > > Regards >> >> > > > Marco >> >> > > > The Netherlands- Tekst uit oorspronkelijk bericht niet >> >> > > > weergeven - >> >> >> > > - Tekst uit oorspronkelijk bericht weergeven - >> >> >> > Jon thanks for the response. >> >> >> > There are two things. The form I use is not a continious one its >> >> > actually Datasheet, my mistake. >> >> > I put the code in the Current event because the On Active didn't >> >> > work. >> >> >> > It does highlight the record now but when I try to scroll through >> >> > the >> >> > records the highlight dissapears. >> >> >> > Marco >> >> >> > I've just tested this in the Current Event on a Datasheet and it >> >> > seems >> >> > to >> >> > work fine. How are you scrolling through the records? I'm pressing >> >> > the >> >> > Down Arrow and am getting each row highlighted as if a was pressing >> >> > the >> >> > Record Selector. Maybe you have other code executing affecting this? >> >> >> > Jon- Tekst uit oorspronkelijk bericht niet weergeven - >> >> >> > - Tekst uit oorspronkelijk bericht weergeven - >> >> >> I have a conditional formatting on a deadline field it checks the >> >> date. >> >> Maybe that's causing it highlight to dissapear. >> >> >> Marco >> >> >> Maybe - temporarily remove it and check. >> >> >> Jon- Tekst uit oorspronkelijk bericht niet weergeven - >> >> >> - Tekst uit oorspronkelijk bericht weergeven - >> >> > That doesn't change anything. >> >> > MArco >> >> I would suggest that you create a new Datasheet form based on an existing >> table and put DoCmd.RunCommand acCmdSelectRecord in its Current Event >> just >> to prove that it works in your version/SP of Access, then examine the >> differences in your real scenario to find out what the problem is. >> >> Jon > > I got it working in a new form, don't why it doesn't work in an > existing form... > How should I use this? > > MArco As far as I know, DoCmd.RunCommand acCmdSelectRecord is the only method for doing what you want. You have seen that it works in a new Datasheet form. Without seeing your database I can't really help any further. You need to figure out why it won't work in your existing Form. Try making a copy of the Form and then remove all code, events, controls etc. bit by bit to find out what's stopping it working. Jon
First
|
Prev
|
Pages: 1 2 3 Prev: Many-to-many question Next: unable to put an option group on a subform without crash |