check previous data

It took some getting there but we did it. Hope that's solved you issue completely.:)

David
 
Hi Dcrake sorry it doesnt work still. Here is what i am entering in:

Private Sub Command5_Click()
If DCount("Quarter", "Test", "[Quarter] = '" & Me.Quarter & "' And [Project_Reference]= " & Me.Project_Reference) > 0 Then
MsgBox "Sorry sir....this quarter has already been entered previously. try again!"
Exit Sub
End If
DoCmd.GoToRecord , , acNewRec
End Sub
 
The problem that i am still getting with the code is that it still picks up the quarters entered in other projects, so it wont allow me to add in the same quarter for a different project.

Thanks
 
Gone through the code and cannot see why it is not working?? Any ideas??

Thanks
 
Lets do it another way

Code:
Dim HowMany as Integer
Dim strString As String

strString = "[Quarter] = '" & Me.Quarter & "' And [Project_Reference]= " & Val(Me.Project_Reference)


HowMany = Nz(DCount("Quarter", "Test", strString),0)

If HowMany = 0 Then
   MsgBox  strString,,"No Records Found"
   Exit Sub
End If

Assumptions are made that the quarter is a string and the Project_Reference is a number

David
 
Hi Dcrake,

thanks for your help, i finally managed to fix. Thanks for your input.
 
out of interest ... another idea that maybe yuo didnt realise you could do

do you have 100's of these, or just a few

if you have lots, the easist way is to input them into a structured spreadsheet, and import the spreadsheet. - better still, you may even already have them in a csv or text file - which will avoid any rekeying at all.
 

Users who are viewing this thread

Back
Top Bottom