Modules & VBA :: Private Sub - Some Checkboxes Are Locked
May 12, 2015
Okay I have a Private Sub on form PlotF:
Code:
Private Sub SetCheck212()
If Me.[Check161] And Me.[Check169] And _
Me.[Check167] And Me.[Check181] And _
Me.[Check261] And Me.[Check189] And _
Me.[Check187] And Me.[Check195] And _
Me.[Check203] And Me.[Check201] Then
Me.Check212 = True
[Code] .....
Some of the checkboxes are locked as I want to force the user to check them on another form (InvoicedF) but I want them to be displayed PlotF as well.
So I want to call the Private Sub from another form. So that the Check212 still automatically checks to true with out PlotF open on the screen.
Is this possible, Do I have to make this private sub a public sub? If so how do I do this?
View Replies
ADVERTISEMENT
Oct 14, 2013
i want to run btnLast in "Private Sub Form_Open" that way, when i open my form it wont display my first record, rather my last.
View 4 Replies
View Related
Apr 22, 2014
I have a after update event that will match the written record with any exist record in a table in the field "OrgName". If it doesn't find exact match, will call a function with a "soundex" algorithm to see if there is only a misspelling or another name altogether.
In the afterupdate event, I have a string called strOrg (wich is the name I want to compare).
I have the soundex function in a module, so I can use it for several form generally.
What I want is to pass the strOrg to the soundex function, however I don't know how to declare the variables. however I keep having this error:
"compile error: Argument not optional"
and goes to the line tagged as 1 in the private sub afterupdate
The afterupdate sub is the following:
Code:
Private Sub tOrgName_AfterUpdate()
Dim strOrg As String
strOrg = Me.tOrgName.value
If IsNull(DLookup("orgID", "torg", "OrgName = '" & strOrg & "'")) Then
resMsg = MsgBox("This organization name is not in the list. If you want to look for similar names press YES, if you want to register a new organization press NO.", vbYesNoCancel, "Organization not found")
[Code] ....
and the soundex function is declared as
Code:
Public Function Soundex(strOrg As String) As String
Dim Result As String, c As String * 1
Dim Location As Integer
View 3 Replies
View Related
Sep 26, 2014
I've got a private sub that runs when the form loads. I want it to get the id of the record which has opened this new form.
The public sub populates the variable but it's Empty going back into my private sub. I'm sure its a simple school boy error but it has me stumped!
I want it public as I need to keep that id as new records are added in the form.
Private Sub Form_Load()
FRStudentFundingRequestID
'fundingrequest = FundinRequestID
Me.txtFKFReq = FundingRequest
End Sub
__________________________________
Public Sub FRStudentFundingRequestID()
FundingRequest = [Forms]![frmFundingRequest]![txtpk]
End Sub
View 3 Replies
View Related
May 2, 2014
I'm having a rough time finding information regarding filtering using multiple check boxes that are not part of an option group. I have 4 "sets" of check boxes that can each have multiple selections made.
For example I have:
12 check boxes for each month
6 check boxes for a selection of years
6 check boxes for order types
5 check boxes for order company
I have written code that successfully creates a string depending on what boxes are checked that looks like this.
[Ship month] = "1" OR [Ship month] = "2" OR [Ship month] = "5" AND [Ship Year] = "2013" OR [Ship Year] = "2014" AND [OrderType] = "SO" OR [OrderType] = "SM" AND [Order Company] = "10430" OR [Order Company] = "10440"
The problem is that it does not filter correctly. After playing around with it I found that as long as the entire is using all AND operators or all OR operaters it works fine, but as soon as I mix them it doesn't work.
View 4 Replies
View Related
Dec 17, 2013
I'm trying to write some simple code to see whether two check boxes (named cbM001 and cbM011) have been checked and if so, then send out an error message. So far I have tried:
If cbM001 Is False And cbM011 Is True Then
MsgBox "M011 cannot be selected unless M001has also been chosen."
Exit Sub
[Code].....
With this I get "Run-time error 424: object require"
View 6 Replies
View Related
Sep 13, 2013
We have a small lab database where we insert the results of a water plant test. The results can be either Before treatment or After treatment.
And it can be treated numerous times a year.
I have created form with a drop-down box to select the customer and a button to show reports for the selected customer.
But I also want to add 2 check boxes: a Before treatment and After treatment box. And also add a date range.
So when selecting to view reports our users can select a date range example:
01/01/2013 to 01/10/2013 and a check box so users can select if the results to be displayed are Before or After treatment.
View 1 Replies
View Related
Jan 30, 2014
I have a code which cut the data from tables and insert to others. The problem is I don't know when I can do this process (when I will cut data and the same time some users lock editing records then I will get an an error). So my question is, there is some procedure which can check that some records in table are locked or not?
View 6 Replies
View Related
Mar 9, 2005
Hi all
I want to make an on click event to run the code in another private sub on the same page.
I tried goto and call.... but I haven't got the syntax right.
Any ideas how I can do this??
Thanks
Damon
View 4 Replies
View Related
Apr 15, 2015
I have 8 checkboxes. Each checkbox has several e-mail addresses as string. Therefore, each checkbox has a string variable declared. I was wondering what should I do when selecting multiple check boxes. This is my code:
Code:
If Me!chkAGDLLA = True Then
Forms!email.lstName = Null
Forms!email.chkComercial = False
Forms!email.chkOperacional = False
strAGDLLA = "email1, email2, email3, email4"
strMail = strAGDLLA & ", " & strISA & ", " & strMAYA & ", " & strSANGER & "," & strSANSE & ", " & strSede & ", " & strGC & ", " & strCSR
MsgBox strMail
End If
Problem is that if I only select chkAGDLLA, then strMail will be "email1, email2, email3, email4, , , , , , ,"
I do not want all those commas, but how to make this work. I was thinking maybe a SELECT CASE so that strMail will accumulate data based on what's checked, but then there will be a problem of there being no comma between cases.
View 6 Replies
View Related
Dec 2, 2013
I have a form that I allow my users to view but not to change any of the records.
As the number of records has grown it's become necessary to add a search function.
My problem is that because the form is locked it cannot be searched.
View 7 Replies
View Related
Jun 28, 2014
I have a Form with a combobox and 3 checkboxes now i want to change the Rowsource of the Combobox by clicking on the checkboxes. When i click the Checkbox the Rowsource gets Changed as i want it but i can not use the new Values cause its giving me the error "The value you entered is not valid for this field"
The Funny thing is its always bound to the type of data i choose first. When i first select the Week i can select only Weeks (17,18,19 etc)
When i choose Day first it only accepts Dates (01.01.2014 etc)There is no Control Source set . And the Bound Column for all Sources is 1
Here the Code
DD_Zeitraum is the Combobox
CB_Day CB_Week CB_Month are the Checkboxes
Code:
Private Sub CB_Day_Click()
If Me.CB_Day.Value = -1 Then
Me.CB_Month = 0
Me.CB_Week = 0
Me.DD_Zeitraum = ""
Me.DD_Zeitraum.RowSource = ""
Me.DD_Zeitraum.RowSource = Dist_Datum
Else
Me.CB_Day.Value = -1
End If
End Sub
[code]...
View 10 Replies
View Related
Nov 29, 2013
I have a field 'Payment Types' with values (Cash, Cheque, Debit/Credit Card) and a field 'Payment Received' which is Yes/No.
When putting the order through the user selects the payment type and ticks a box if payment has been received.
On a report for delivery drivers, the owner wants it simple for the driver... he wants all the payment types listed with a checkbox next to each one, then wants the appropriate box ticked if payment has been received.
So I need something on the report (or underlying query) which ticks the appropriate box, i.e.
If payment received = true then payment type checkbox = true.
Or should I put the payments into a separate table with both fields so multiple payment types can be marked as paid?
View 6 Replies
View Related
Jun 18, 2013
I am looking to lock my database until the user puts in the correct credentials.
I have already put the form on Pop Up and Modal. They can still select the "X" in the top right of the window.
View 1 Replies
View Related
Dec 29, 2011
I want to create a split-database. I want the entries made on the front-end to update into a combined table in the back-end.
Back-end: One table with everyones entry
Front-end: Multiple forms that feed into the back-end.
When person A accesses his front-end form, he can only see his entries.
When person B accesses his front-end form, he can only see his entries.
When manager A wants to look at the back-end, he can see everyones entry in one table.
View 1 Replies
View Related
Jun 19, 2014
I have the following code which errors on line
Code : .OpenDataSource Name:=CurrentProject.FullName, SQLStatement:="SELECT * FROM [qryMailMerge]"
The error (Error has occurred: The database has been placed in a state by user 'Admin' on machine 'W74XXXXXX' that prevents it from being opened or locked) appears in the Word document.
Code:
Public Sub CreateWordToPDF(strWordFile As String, strPDFFile As String, strSQL As String)
'Call CreateWordToPDF("C:Doc1.doc", "C:Doc1.pdf", "SELECT * FROM [qryMailMerge]")
Dim objWord As Word.Application
Dim docWord As Word.Document
'Open MS Word using early binding.
Set objWord = New Word.Application
Set docWord = objWord.Documents.Open(strWordFile)
[Code]......
View 8 Replies
View Related
Aug 25, 2006
Hi there,
I would like to return the record number (row position) of a record in a table, using its private key (no duplicates) by querying it in a form. Is there a query (sql or VB) that can do this?
I intend on using the record number to navigate/Jump to the respective record within a form. I'm using a (selected) list of records from the table in question in a navigation box. Clicking on a record in the box, would cause the fields in the form to jump to that record. I was using;
Private Sub List20_AfterUpdate()
Dim Current As Integer
Current = Me!List20.Value
DoCmd.GoToRecord acDataForm, "frmResultInput", acGoTo, Current
End Sub
List20 was bound to the private key in the table, which at one point was equivalent to its row position...
cheers
View 3 Replies
View Related
Jan 20, 2006
Any idea how I can display this information a lot neater?
Its a bunch of check boxes (I wasn't sure how to go about doing this without them, as they can choose multiple things, if it was just 1, I would have used a dropdown).
I've been trying to fiddle with this for a while now with no good ideas coming to mind.
Anyone have any ideas or examples of how I could go about this?
Thanks
View 4 Replies
View Related
Jan 14, 2007
I am trying to use check boxes as a yes/no answer about whether members have completed training modules, and bind them to a table.
I get this error when tick the boxes, and try to close the form; "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. (Error 3022)"
When I reopen the form the check boxes are greyed out until i tick them (not getting values from table) :confused:
Any help appreciated :confused: :)
Matthew
View 1 Replies
View Related
Apr 11, 2007
I have a form that uses checkboxes to list all the fields in a table. How would I create a query based on that form?
For example -
Field Names - RMA_Num, Qty, Date_Rec, Part_Num, Desc, CC_Primary, CC_Secondary, CC_Tertiary, OF_Appearance
A user may choose to see Qty, Part_num, CC_Primary, CC_Secondary, and CC_Tertiary. How would I set up the query?
For testing I tried having RMA_Num, Qty, and Date_Rec in a query. I set the criteria for RMA_Num as IIf([Forms]![frm_meta]![Check0]=True,[tbl_Mfg_RMAData]![RMA_Num])
With the box checked the query will return results for all the fields. But if the box is unchecked the query returns nothing.
View 3 Replies
View Related
May 4, 2006
I have 4 check boxes represent 4 grade levels. When I click on a grade I have a query run for me a list of all 9th graders or 10th graders or both together.
When I run the form for the first time, all four boxes are check, when I unclick all of them and I click which ones I want the form does not work. But if I leave them click the report will work. Basically what is happening is when I unclick them, the lose their value.
I have the check box set up with a Default Value as "09" or "10" base on what Grade Level there is.
So my two questions are, how do I keep the value of the check boxes after I unclick and click again and Secondly, is there a way to have the boxes unchecked when I run the program?
View 10 Replies
View Related
Dec 14, 2006
I have form, with a number of orders on there, i wanted to be able to give the user the option to select all the orders and update each record, however when i give the user the option to seleect all the orders on the first line is updated. how can i get all the records to be updated the code i am using is shown below, any help will be greatly appreciated.
Dim db As DAO.Database
Dim String2 As Integer
Dim i As Integer
Dim rs As DAO.Recordset
Dim StrSQL As String
Set db = CurrentDb
Set rs = db.OpenRecordset("kell")
For i = 1 To Me.Quantity
Stringy2 = InputBox("The Cylinder/Cylinders Will Be with the driver
from The Specified Date Below:-", "Spec Gas 2006, (DD / MM / YY)", Me!Text68 & "")
If StrPtr(Stringy2) <> 0 Then
rs.AddNew
rs![Line Number] = Me![Line Number]
rs![Time of Transaction] = Me![Transaction Date]
rs![Cylinder Barcode Label] = Me![Cylinder Barcode Label]
rs![Cylinder Number] = Me![Cylinder Number]
rs![ProdNo] = Me![ProdNo]
rs![Status] = Me![Status]
rs![AberdeenWONumber] = Me![AberdeenWONumber]
rs![Works Order Number] = Me![Works Order Number]
rs![CustNo] = Me![CustNo]
rs![Customer Order Number] = Me![Customer Order Number]
rs![Date of Transaction] = Stringy2
rs![User name] = Me![User name]
rs![Employee ID] = Me![Empoyee ID]
rs![A Number] = Me![A Number]
rs![New Status] = "With Driver"
rs![Date of Transaction] = Me!Text68
Me.Text71 = "With Driver"
Me.Text71.ForeColor = vbRed
Me.Text74 = Me.Text68
rs.Update
MsgBox "The cylinder is now with the driver", vbInformation, "Returned Successfully"
End if
Next i
rs.Close
db.Close
End Sub
View 2 Replies
View Related
Jan 7, 2005
I have a database which uses checkboxes, however I only want my users to be able to select one or the other, not both.
How do I disable the second box when the first one is checked?
Thanks in advance
Kat
View 2 Replies
View Related
Jul 29, 2005
Hi
I know this sounds stupid but on my database with user-level security, i have somehow managed to remove administer rights from all users , and do not know how to change it back, if it is even possible.
I think what might have happened is it was stored on my USB drive and i switched computers and opened the db, would that have affected it? :confused:
Is there an easy way out of this or am i screwed? :eek:
thanks, ian :)
View 5 Replies
View Related
Aug 29, 2007
I have been following a text book to try and secure a database, i set up the Work Group Info File, allocated a password, now even when i want to start a completley new database i have to enter a password.........
AND when i set up the password i must have enetered it wrong now i am completely locked out!!
Is there any way to fix this i cant do anything!! I cant even start on a completely new databse!!
Please help
View 8 Replies
View Related
Jun 6, 2007
Sorry, but this is killing me. I can't find anything in the archive which directly relates.
And it's complicated. I'll try to simplify.
In a nutshell:
As I scroll each Employee on a Parent form, I'd like a subform with functionality to check off any Certifications earned by this person and write the EmployeeID and CertificationID to a junction table.
Seems to me it should be simple, but...
Anyway, here is the probably overcomplicated version here:
The one side tables are 1. Employees and 2. Certifications
The junction table records which certifications employees possess. This table contains some Boolean fields.
The Parent form knows the EmployeeID.
My goal is to create a subform on which to display the full list of Certifications, something similar to the attached image, with a button to add an EmployeeID to the junction table AND tick off the Boolean checkboxes.
I've based the subform on a query showing ALL Certifications and all (Junction) records where there is a match
Because the junction table only stores related Employees and Certifications as entered, the checkboxes on my subform cannot be bound directly to the fields in the junction table and, at the same time, allow me to check off the Booleans.
Perhaps a little db redesign? Any help greatly appreciated.
View 2 Replies
View Related