(1) I do not remember how the ) got there. I do remember removing it from the form. I did not remove it from the subform.
(2) I deleted the old subform and created a new subform with the control named BkPg.
(3) The backcolor from the Conditional Expression is working.
(4) Debug.Print...
I do not know how to create a query to show all names on the controls on the form. I can click through the form in layout mode and look at the control names.
There is a subform on the form that references the control BkPg within the same query as the form.
Name BOOK-PAGE-2012)
Label Name...
I created the sub by creating a Before Update Event Procedure on the form.
Private Sub BOOK_PAGE_2012__BeforeUpdate(Cancel As Integer)
Dim sBkPg As String
Debug.Print Me.[BkPg].Value 'check the value since it might not be set
Let sBkPg = DLookup("[BkPg]", "qry_copyrequest", "[BkPg] = '" &...
..."Variable not yet created in this context."
Is it wrong to have a control named BkPg ? The Conditional Formatting Expression did not work until I renamed the control BkPg.
Conditional Formatting Expression (which is now working):
DCount("*","qry_copyrequest","[BkPg] =""" & [BkPg] & """")>1
What a great idea. I cannot step through the code.
Private Sub BOOK_PAGE_2012__BeforeUpdate(Cancel As Integer)
Dim sBkPg As String
Debug.Print Me.[BkPg].Value 'check the value since it might not be set
Let sBkPg = DLookup("[BkPg]", "qry_copyrequest", "[BkPg] = '" & Me.BkPg & "'")
MsgBox...
Andrzejek asked "What is the Let?" I have no idea. It was contained in the code posted on Stackoverflow by "Rick."
I was thinking, "it works!" But, the VBA code does not have any method described to change the color. What changed was renaming the control source.
I tried DLookup code I found on Stackoverflow. I modified it to fit my ACCDB.
Option Compare Database
Private Sub BOOK_PAGE_2012__BeforeUpdate(Cancel As Integer)
Dim sBkPg As String
Let sBkPg = DLookup("[BkPg]", "qry_copyrequest", "[BkPg] = '" & Me.BkPg & "'")
MsgBox "This Book & Page already...
...Sub BOOK_PAGE_2012__BeforeUpdate(Cancel As Integer)
Debug.Print Me.[BkPg].Value 'check the value since it might not be set
If DCount("*", "qry_copyrequest", "[BkPg]='" & Me.[BkPg].Value & "'") > 1 Then
MsgBox "The Current BOOK-PAGE has been used already, please supply a...
Duane:
Again, thank you for trying to help with this issue. I checked the data which was input, wondering if special characters (i.e. the "-") made a difference. It did not.
After entering a value without special characters, the expression is still not evaluating for a duplicate.
I...
I am getting no error. I set the ID to turn red if n>1. And, the background should turn red if the record BOOK-PAGE-2012 is a duplicate.
I checked the record and there are no spaces in 71-151 in either the new record or the original record.
Duane: Thank you very much. This code is not working for me. I have copied the code into the expression exactly.
I applied the same formatting structure on the field RequestID which is a Number, Double. That doesn't work either.
qry_copyrequest:
SELECT tbl_copyrequest.ID...
...name is tbl_copyrequest
the field with the duplicates is BOOK-PAGE-2012
the datatype is character
Trying to follow microsoft's tutoral, I write:
DCount("*", "qry_copyrequest", "BOOK-PAGE-20120" = " & [BOOK-PAGE-2012]) > 1
Return error "Invalid string."
I am so stumped. Thank you.
Robert
I created a form with a command button to run on click:
I am getting an error:
Private Sub Command5_LostFocus()
' Sub RunRscript()
Dim shell As Object
Dim path As String
Dim waitTillComplete As Boolean: waitTillComplete = True
Dim style As Integer: style = 1
Dim...
I would like to run an R script I have named "iterate.R" from an MS Access module via a command button on a form.
I found the following code on StackOverflow, but something is wrong when I substitute my path.
Link
Sub RunRscript()
Dim shell As Object
Dim path As String
Dim...
I would like to show the total of my subform on the main form.
I have tried to create a textbox on my subform using =Sum([WI])
I have seen and read examples, but in my case, this formula only returns the message: #error
I tried to use Dsum that I read in thread702-1778486.
The...
Andrzejek: I do realize I could have edited or deleted my post. I was thinking that what I discovered might have helped someone else who had the same question.
Robert
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.