before update code
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intCheck As Integer
Dim strDates As String
Dim strDuration As String
Dim strTrainer As String
Dim strCondition As String
Dim strMessage As String
Dim intResponse...
Yep I created the module and pasted the code. I've renamed it mdlDuplicatesCheck as you suggest.
I went to debug then compile and got a new compile error. This time it's on the line from the before update code DuplicatesCheck = True. Duplicates check= is highlighted and the error is...
I'm getting a compile error on the 'Create_multiple_Records' code.
The line is
If DuplicatesCheck = False Then
The compile error is type mismatch and the = symbol is highlighted
Thank you so mch for the time that you have spent on this. As I said I was away from my PC so am just getting to this now.
So I've created a module and put the function in. Then I've pasted the duplicates code into the the multiple records code called by the button. As you suggested I...
The save record sql creates the records. That I have tried and tested.
So I tried putting your code into the multiple records code. When I click the button though absolutely nothing happens. No warnings, no debugger etc. Also when I try to compile the database I get and error with Cancel = So...
But how can I get round that? Running the sql is what creates the multiple records. If this is stupid idea please say so but Could Ipaste your code in it's entirety before the DoCmd.RunSql?????
Private Sub Create_multiple_records_Click()
Dim strSQL As String
'As you are entering the first record manually with the end date the sql only addes the dates greater than the first date
'This only works where all fields are filled in - you should probably build in a check to see if the...
The records are saved using the 'Create Records button which has code behind it which may be clashing.
The code at present looks like this
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intCheck As Integer
Dim strDates As String
Dim strDuration As String...
I'm almost scared to tell you this. With the new code it let me enter a set of new records as it should. But then I entered a duplicate record for one of the dates and it allowed me to. :(
Apologies
I just thought it would save you some work.
I'm also wondering if the following should be changed to:
strMessage = "This event clashes with" & IIf(intCheck = 1, " an ", " ") & _
"existing event" & IIf(intCheck > 1, "s", "") & _...
So close....
I did the Dim strTrainer_Name as string and amended the str condition to:
strCondition = "(#" & Me.Start_Date & "#" & BTWN_DATES & strDuration & strTrainer_Name & ")" & _
" OR " & _
"(#" & Me.End_Date & "#" & BTWN_DATES & strDuration &...
It's a bit late in the day to think of this but could a find duplicates query have been amended to do this or is that just the same as using indexes in the resourcing table?
I'm back to getting a syntax error when I add Trainer_Name
Do I need to set up some sort of Dim? Something like Dim strTrainer_Name as string Here's what I'm attempting to run:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intCheck As Integer
Dim strDuration As String
Dim...
First sorry for my late response. I've been delivering training today and will be again tomorrow so can't always respond when I would like to.
Yes you are making sense. I think we're both on the same page although you express it better than me because you know what you are talking about...
That's exactly right.
So a conflict would be any event that had the same combination of Trainer_Name, Start_Date and Duration within the range of start and end dates entred.
Hope that makes sense outside of my own head