Unable to input data into my form ...

M

Mikey C

This is very odd - I have no idea what has happened!

When I try to imput a record into one of my forms (or edit an existing
one), it lets me do it until I get to the end field in the row and
then it will not let me tab any further - I have to close the form and
lose my changes or press undo.

At the end of each row I have created fields which are not enabled but
are visible which display the username and date of a new record and
the same for when any records are edited. Usually I can tab from the
previous field ('comments') to the next record or create a new record
- the username and date is automatically updated in the appropriate
fields.

I have noticed that when I now create or edit a record, the usernames
appear but not the dates. i have checked the code but can find no
problems with it (see below for code used).

It's worked with no problems until when I just noticed today. I
usually do a mixture of inputting directly to the form and importing
using a spreadsheet (when lots of data). I can still import from a
spreadsheet with no probs and am still able to edit / add new records
directly into the table.

It must be something related to the following code (as mentioned
above):

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Me.[Created By] = CurrentUser()
Else
Me.[Last Modified By] = CurrentUser()
End If

If Me.NewRecord Then
Me.[Created Date] = Date
Else
Me.[Modified Date] = Date
End If
End Sub

Anyone got any ideas??
 
M

Mikey C

Just a quick update ....

It's deffo caused by the following lines of code:

If Me.NewRecord Then
Me.[Created Date] = Date
Else
Me.[Modified Date] = Date
End If
End Sub


If I remove them it works fine. I have no idea why it has just decided
to roll-over and die - Anyone??

This should put the date in the 'Created Date' field if it's a new
record or the 'Modified Date' if modified
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top