I am a newbie to Access. I have a check box on my form that defaults to checked, meaning the record is active, what I want to do is when the box is unchecked, not have the record appear as an active record and just be on the table. I have the check box on the table and when I uncheck it on the form it unchecks on the table but don't know how to stop it from appearing in the active records. Thanks for your help, April
I am writing the following code to check if 'Active' field in table TypeTable2 is ticked or not for records. If I write the following statement to select the records from Access table where Active is not ticked then it gives "data Type mismatch in criteria expression".
Code: strsql = "SELECT distinct EnvelopeType FROM TypeTable2 where Active='Yes'
hi I want to set record selector on the form with a record number that I am founding it with this code: Code:Dim con As ADODB.ConnectionDim cmd As ADODB.CommandDim rst As ADODB.RecordsetSet con = New ADODB.ConnectionSet cmd = New ADODB.CommandSet rst = New ADODB.Recordsetcon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentProject.Path & "hazineh-bime.mdb" & ";Persist Security Info=False" cmd.CommandText = "select * from table1 where salp=" & Val(Trim(Form_mainhazineh.sal.Value)) & " and mahp=" & (Trim(Form_mainhazineh.mah.Value)) & " " Set cmd.ActiveConnection = con rst.Open cmd, , 1, adLockReadOnly If rst.RecordCount = 1 Then ' found the record else end if I mean I want to change the active record on the form with another one . how can I do it?
Based upon a specific date (varDate), I want to select the record that is active (who drives the lease car).
row 1 user X from 13/11/2013 row 2 user Y from 15/11/2013 row 3 user Z from 17/11/2013
I want to find the active user on a date. So on date 13/11/2013 (=varDate), user X is active, on 14/11/2013 (=varDate), user X is still active, on 15/11/2013 (=varDate), user Y is active, on 16/11/2013 (=varDate), user Y is still active and on 17/11/2013 and later, user Z is active.
I have created a form to select multiple records for a transmittal report. I added a button to the form which I would like to open the report to view the current record. In the On Click event I added the following code:
Private Sub cmdPrint_Click() Dim strWhere As String If Me.Dirty Then 'Save any edits. Me.Dirty = False End If If Me.NewRecord Then 'Check there is a record to print MsgBox "Select a record to print" Else strWhere = "[TransmittalID] = """ & Me.[TBLTransmittal.TransmittalID] & """" DoCmd.OpenReport "RPTDwgTransmittal", acViewPreview, , strWhere End If End Sub
The debugger keeps highlighting the row above shown in red. I've used this same code before on other forms and it worked but not sure why it isn't working this time. The only difference with this form and previous ones is that this form contains a multiple values combo checkbox (hope that's the correct term). The query that the report is based on changed the names of the field names so that TransmittalID on the form is TBLTransmittal.TransmittalID in the query.
I've tried the code with and without the extended name but each time the "Do.Cmd..." is highlighted.
I have a main form that controls 2 subforms. sbfActiveProjects displays a list of records that have not been flagged as complete. Upon clicking on a record in sbfActiveProjects, the details of that record show up in sbfProject. This functionality works great, except when I try to create a new record. The code works fine for getting a new record, however once I run the command I lose my ability to navigate to other active records.
Code: Private Sub cmdNewProject_Click() 'set focus to sbfProject sbfProject.SetFocus 'navigate to new record DoCmd.GoToRecord , "", acNewRec End Sub
I have created a database containing customer records and i wanted to somehow add a part where an individuals records will automatically be deleted if they are not active for 3 years+
I'm trying to add a new functionality on my search form where the user can search for records that haven't been modified(based on the field DateModified) for certain amount of time.This is what I added in my search function but it's giving me "Invalid use of Null"
If Not IsNull(Me.txtInactiveTime) Then Dim LValue As Integer LValue = DateDiff("d", Me.DateModified, Date) Select Case Me.txtInactiveTime Case "> 1 month" strWhere = strWhere & "(LValue >= " 30 ") AND " Case "> 2 months" strWhere = strWhere & "(LValue >= " 60 ") AND " End Select End If
txtInactiveTime is a combo box where the user chooses the time during which the records haven't been modified.(i.e. 1 month, 2 months etc.)
I have a multiuser data entry form which on using somtimes gets inactive, means the button stop working and we have to close the form and open again to avoid.
I have some tables with data where in one column the user will choose a status between 30-40 different options. They are choosing this option to show a reason why a trade was pended and not approved immediately. These reasons seem to change frequently and sometimes we no longer want to use an old reason.
I do reporting back several years, so I cannot just 'remove' a reason or it will be removed from the table and I will have blank reasons. When selecting the specific reason, the table takes the dropdown from another table that simply lists every possible reason. I want to know how I can make it so that the reason that is no longer in use remains on that connected table, but when the person entering data clicks the dropdown button, the removed or inactive reason no longer shows up as an option.
Previously I had seen people add a column to the connected table of reasons and use a "yes/no" check box to show if the reason is now Inactive. When you checked YES on inactive, the reason would disappear from the dropdown list. My issue is that I do not know what language or formula to use (or where to use it) so that when I click Inactive = Yes, the reason disappears from the dropdown menu.
I'm reworking a db to make it web compatible. Right now I'm working on my Price and Sales tables.There are about 900 Sales records, 450 Price records (for about 45 Items).
I have re-done my Price table with an Autonumber Key field. (It had a multi-key which I understand web db does not support.) Each autonumber key represents a Date with new Price for a Company/Item. The Price change Dates are random.
I have put a Foreign Field in my Sales table for the Price key field.
My dilemma is matching the Sales with the Prices.
When the Price Date and Sales Date do not match (at least half of them don't match), I need to look back in the Price table to the max Date BEFORE the Sales Date in the Sales table for that Company/Item in order to select the correct Price key.
We have a form that will have one combo box for Associates (like Employee in the OPs DB) which I've got set to show only active Associates for new entry per the tips in the above thread, but we'll also have a combo box for Developer which I need to function the same way. I don't know how to add that part to the On Current event?
Code: Private Sub Form_Current() Dim strComboRowSource As String If Me.NewRecord Then strComboRowSource = "SELECT T_Associates.AssociateID, T_Associates.Associate, T_Associates.Active " & _ "FROM T_Associates " & _ "WHERE (((T_Associates.Active)=True));"
I have an application that enters candidates in, who apply for a job.
I found that I can enter a candidate in, and if I dont enter at least an address type or phone type ( giving that candidate an address record, albiet a blank one (just a type of address) and a phone record) then the candidate wont have a sub record for addres or phone at all.
This is hurting my reports. They are set to pull the primary address and phone only, as we dont need to have 2-3 contact information for a candidate on a report This is how I found out that I had blank address and phone for some test records. I need to be able to check when a person does a number of things, that at least the combos for phone type and address type have been chosen as something. This will ensure that they have a primary address and phone, as I have code that takes care of all that. I tried putting the following code in the form's before update, but since it is calling to a subform, the minute I tab TO the address combo, I get the message. The form is updating before I get the chance to skip the field.
Here is the lay out. A user can enter in candidate, their address, phone, application and activities. Address, phone, applications and activities are all sub reports on a tab control. The user should be able to move freely within any record, and only be bothered when they try to leave, if important information is still empty. I dont want to control how they enter ('you must enter this first!' lol) just that they do enter it in the end.
What I want to do is check when the user is leaving a record.(closing form, going to another record, clicking the search button that opens another form etc) if either combo is empty (no primary contact info) then it gives the message and goes back to the combo that is empty.
Here is the code I have. If anyone can help me find the right place to put it, I would really appreciate it. Thank you,
If IsNull(Me.[subAddressEntry].Form![cmbAddressTypeID]) Then msgbox "You must enter an Address" Me.[subAddressEntry].Form![cmbAddressTypeID].SetFocus Cancel = True ElseIf IsNull(Me.[subPhoneEntry].Form![cmbPhoneTypeID]) Then msgbox "You must enter a Phone" Me.[subPhoneEntry].Form![cmbPhoneTypeID].SetFocus Cancel = True Else: Cancel = False End If
If I can't figure this out, I am thinking of making a new address type and phone type. Call it "none chosen" and then make that a default selection. Then one would always be chosen...I think. I would like to avoid that though.
I have several tables linking our employees to certain supervisors, etc.On the Form, there is a drop down with all employees listed that someone can select and then enter the stats required. When someone leaves the firm, I want to remove them from the form dropdown list, but not delete them from the corresponding table. I have seen this in other databases where they someone added an 'Inactive' column with a Yes/No response and when you selected the inactive - yes, that name would disappear from the form when people select names from a dropdown to enter stats.how to make the names disappear from the view in a form, but not in the table related to that form?
I'm sure the coding is very simple, the question is .... can I build an expression using an IIF statement that checks whether the current field is the same as the same field in the next record? If it is put a 1, if not put a 0. Easy in Excel, not sure about Access??
i would like to check a record exits before a new entry is saved. However i would like to check on three criterias and i am not sure on how to write the if statement.
IF Dcount "CompanyName" & "FirstName" & "Last Name" from "tblcustomer" is the same as "frmCompanyName" & "frmFirstName" & "frmLastName" > 0
I am running a check for checking whether a value already exists in the database table. But the problem is that the control passes right through this check.
It does not give an error too...
If txt_id.Value = DLookup("id", "indicateur", "id=" & txt_id.Value) Then info = MsgBox("Cette 'Id' déjà existe !", vbInformation)
I would like help with a macro that looks to see if a record in my database table exists, then if it doesn't it adds a record with my data, but if the records does exist, it stops the routine and sends a message box to prompt if you want to continue with adding a new record.
The problem that I'm having is that my macro errors out when it doesn't find a record. I just want my macro to just see if a record exists or not. Then I can write my Iff statements based on whether it finds our or not. How do I just have my macro check for an record, then if it doesn't exist tell that it doesn't exist and not stop my macro. Is there some kind of IfExist() function or something?
I need to know how to check if there is a record set matching a name and insert record if there is not one, otherwise just update if a record does match. See code: Code:<%Name = request.form("name")picture = request.form("picture") opencnset rs = Server.CreateObject("ADODB.RecordSet")'if no record matches the nameSQL1= "INSERT INTO background (Name, Picture) VALUES ('" & name & "', '" & picture & "')"'elseSQL1= "UPDATE background SET Picture = '" & picture & "' WHERE Name= '" & name & "'"cn.Execute SQL1closeCN%> Thanks in advance for any help you all can provide!!!! -Chris Gordon
i managed to get checking for duplicate record by ONE field ie member_no
code :
If DCount("*", "runner", "member_no = " & Me.member_no) > 1 Then MsgBox " This member is already exist!" & vbCrLf Me.c_memberid.SetFocus Else DoCmd.CancelEvent End If
how i want to get checking duplicate record by TWO fields ie member_no and run_no ?
How do you make the spell checker not cycle through all your records when you run it? As it is right now, when a user tries to spell check their entry into the summary block of my form it automatically starts with the first record in the database and goes from there.
I have 2 forms, with a "PNID" field as the link between the 2. In the 2nd form, the PNID field allows no duplicates. I have a button on the first form to open the 2nd form to add a record.
I need some code to put on the button on the 1st form to check whether a PNID record exists on the 2nd form before opening it.......does this make sense? What is happening is that I click on the button, try and add a record, then it tells me one exists and I cannot add a duplicate...
I have looked at the threads, and have tried using DCount? Is this correct?
Hello all, I have a form that looks at my "master table" where users put in general info about a sheet of material. There are two combo boxes on this form, Batch# and Lot#. They will use the same Batch# and Lot# for many sheets. Every time a new batch and lot are entered, this will bring up a pop-up form where the user needs to take a measurement of that batch and lot for QA. This will go into a different table, where the batch and lot #'s are unique(many of the same batch#'s with different Lot#'s). After the lot# is entered, I want to run a query in VB that looks for those unique identifiers, and if it doesn't find a record, my pop-up form will run. This is probably something very easy....... It was a very long weekend and I'm tired of thinking.