control wont update in form

BPBP

Registered User.
Local time
Today, 04:04
Joined
Feb 27, 2009
Messages
64
I have a date textbox on a form based on a query, this date is from a table where the field type is defined as date, but when i enter something else other then the date, the system warning to state the entry isnt a valid date doesnt kick in.

however if the form is based on table, the warning kicks in if i enter something other then date entry.

how do i get the control in the form based on query to do the same validation?
 
My first thought is that you must be formatting the Date Field in the query which is changing the data type to text.

Can you post the SQL for the Query?
 
I'm not sure what's wrong but it doesn't sound right. I've just done a quick test on a form with a query as a data source and the date field still kicks up a warning if anything other than a date is entered in it.
 
My first thought is that you must be formatting the Date Field in the query which is changing the data type to text.
i am thinking this also. A yes or no answer to this might just answer the thread.
 
My first thought is that you must be formatting the Date Field in the query which is changing the data type to text.

Can you post the SQL for the Query?


I've not done any formating for the control. when i key something that is not a date entry it just does nothing. the focus is still at the control but nothing happens, it doesnt switch focus to another control and the form does not update.

here's the SQL for the form source if this means anything to you. Also I attach the picture of the query for the form.

SELECT [QT Job Record].*, [QT Job Status].*
FROM [QT Job Record] INNER JOIN [QT Job Status] ON [QT Job Record].[Job No] = [QT Job Status].[Job No];
 

Attachments

  • untitled.jpg
    untitled.jpg
    90.7 KB · Views: 118
Some more info about the table design and textbox control properties in the picture attached.:confused:
 

Attachments

  • untitled1.jpg
    untitled1.jpg
    96.7 KB · Views: 123
I've found out why the validation didnt kick in. Its because i have some code in the On_error event of the form. When i removed this code, and a non date entry is keyed in, the standard date field validation kicks in fine.

But I've no idea how to modify the code to allow the standard field validations to kick in as i need to retain this code to prevent multi-user generating the same ID number. (of coz this is not written by me, i grabbed it off somewhere :P)

Can some expert pls analyse and advise...

Here is the code.
Private Sub Form_Error(DataErr As Integer, Response As Integer)

On Error GoTo Err_Form_Error

Response = IncrementField(DataErr)

Exit_Form_Error:
Exit Sub

Err_Form_Error:
MsgBox Err.Description
Resume Exit_Form_Error

End Sub

Function IncrementField(DataErr)
If DataErr = 3022 Then
Me![Job No] = DMax("[Job No]", "[QT Job Record]") + 1
IncrementField = acDataErrContinue
End If

End Function
 

Users who are viewing this thread

Back
Top Bottom