Button overwrite last record

dimanche 1 mars 2015

Hi,



I'm trying to develop a Visitor log where I'm using a main form with the guest details and a sub form where sign in/out times and location are entered. In the header I have a combobox with already registered guests, a create guest / sign in button and a sign out button.



My problem is when I hit the create guest / sign in button the data from the location field overwrites the last record and no vba code for this action have been written as I see it?



The code:

Private Sub OpretKnap_Click()

With CodeContextObject

If (.Form.Dirty) Then

DoCmd.RunCommand acCmdSaveRecord

End If

End With




'Sub form

With Me.Logdetaljer.Form.RecordsetClone

.AddNew

!Tlfnr = Me.Tlfnr 'Phone no.

!Logind = Now() 'Time of sign in

!ArbSted = ArbSted 'Location

.Update

End With


DoCmd.GoToRecord , "", acNewRec

DoCmd.GoToControl "Navn" 'Go to guest name


End Sub





Hope someone are able to tell me what to do...



Many thanks in advance!!

Button overwrite last record

0 commentaires:

Enregistrer un commentaire

Labels