Edit Current Record

MartijnAn

Registered User.
Local time
Today, 14:01
Joined
Sep 30, 2004
Messages
51
Hi All,

I Built a form with a selectbox. On each form there a several records shown. After each record you see a selectbox wich you can turn on and off. Now, everytime I click on a selectbox it automatically goes to the first record on the screen, why is that? With this action I want the currentrecord to be modified, but can't figure out how.

I think it has something to do that an 'edit mode' is selected.

Does anyone know how? Thanks in advance.
 
The first record is where the default is, unless you tell it which record to go to. Here is an example of a OnClick event for a cmdButton which opens a second form to the current record on the first frm:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMaterialReturn"
stLinkCriteria = "[QCANo]=" & Me![QCANo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
This is just and example with my names in it, but I hope it gives you an idea on what needs to be done. hth.
 
Thanks,

But it still takes the first value (record). It has to do (I think) that I select a selectbox and that is the same as modifying the table, so it goes to the first record. On click it has to highlight the currentrecord...
 
First of all a form is just a window for a table or tables. It can create records, modify records or delete records. I am not sure what your form looks like or what your OnClick code looks like, can you post your code? What might be more helpful , can you attach a stripped down version of the dbase with a couple records in it? Till I know more about what I am dealing with, I can not strangen it out, but when the code and relationships are right it will work.
 
Hi,

I can't upload anything but I will try to explain better...

When I click on the selectionbox (true or false), it will open a form (docmd.openform). The next form will be based on a query from the record I just clicked on.

Like this:

ValueA Name Selection

123 Hello1
245 Hello2
367 Hello3 x

As you can see, I selected the last record but it highlights the first record.
 
Can you at least post the OnClick code? It would be help to see what does not work.
 
Private Sub Afgehandeld_Click()
If Afgehandeld.Value = 0 Then
AfgDatum.Value = Null
DoCmd.Save
Me.Requery
Else:
DoCmd.OpenForm "formulier5"
End If
End Sub

Somewhere in this code I have to tell that he has to go to the record that I just updated (I think)
 
Oh I fixed it already!

In the 'after update' I told it to save en requery the record. Now I copied it to the click event (last row). That explains why it went to the first record.
 
Glad it is working, good luck with the rest of your project.
 

Users who are viewing this thread

Back
Top Bottom