check previous data (1 Viewer)

DCrake

Remembered
Local time
Today, 03:20
Joined
Jun 8, 2005
Messages
8,632
It took some getting there but we did it. Hope that's solved you issue completely.:)

David
 

COMP

Registered User.
Local time
Yesterday, 19:20
Joined
Jul 20, 2009
Messages
61
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
 

COMP

Registered User.
Local time
Yesterday, 19:20
Joined
Jul 20, 2009
Messages
61
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
 

COMP

Registered User.
Local time
Yesterday, 19:20
Joined
Jul 20, 2009
Messages
61
Gone through the code and cannot see why it is not working?? Any ideas??

Thanks
 

DCrake

Remembered
Local time
Today, 03:20
Joined
Jun 8, 2005
Messages
8,632
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
 

COMP

Registered User.
Local time
Yesterday, 19:20
Joined
Jul 20, 2009
Messages
61
Hi Dcrake,

thanks for your help, i finally managed to fix. Thanks for your input.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 03:20
Joined
Sep 12, 2006
Messages
15,701
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

Top Bottom