I'm using the following code to autofill the city and state on my form.
I can't figure out how to capture if there is no matching record in the table.
If there is no matching record, I will:
1) inform the user with a msgbox
then if the user wants
2) open a form to add the record to the table
Dim rst As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rst = db.OpenRecordset("tblZipcodes", dbOpenTable)
rst.MoveLast
rst.MoveFirst
Do Until rst.EOF
If strZipLookup = rst!ZipCode Then
Me.txtCoCity = rst![ZipCity]
Me.cboCoSt = rst![ZipState]
End If
rst.MoveNext
Loop
rst.Close
End If
How can I capture if there is no matching record in the table?
I have a training database with multiple courses. Certain staff do course1 and thereafter course2. Course1 is only done once and course2 is a refresher done annually. I want the query to find staff that have done course2 but not course1.
I have purposely used "False" to ensure that the first line in my spreadsheet is ignored. This is because the first line in my spreadsheet contains headings that do not match the column names in my table.
I do not wish to change my headings as end users will be making use of my application and they will not like headings such as "int_FactoryID". Likewise I do not want to change the column names in my table to words such as "Factory ID" as this would be a bad naming convention.
Is there a way to use TransferSpreadsheet without necessarily matching the headings in the spreadsheet to the column headings?
Is there a way for TransferSpreadsheet to ignore the headings and assume that the first column in the spreadsheet needs to go to the first column in my SQL Server table?
I am using Access 2007. I have had an application running now for about 1 year and now getting an error when user opens the database. (Have one for front end and one db for backend)
Here's the error message:The form name Switchboard is misspelled or refers to a form that doesn't exist.Also, multiple users are accessing the database at the same time.
I have a large table which is updated everyday. Each record will have a different date but there will be many with the same account number. I have a query which will pull one record from each account number according to a user specified start date, another query which will pull by end date, and a third query which uses both to do a calculation on another field. The problem is, if one of the first two queries does not find a record with that date then the calculation will not be done because there is no record. What I need is a way to go back one day if the specified date does not exist. I have tried using an iif statement in a report with the DateAdd function in the true part. Here is what I have
[blinks_test_end]![Reading_Date] is the user specified date. When I run the report it asks for blinks_test_end, I think it doesn't recognize that this is the user specified date.
I have a problem with my database I have a combo box that will search for my record. Actually its working I input the specific number it goes to the specific record. But I want, if there no existing record in my database it will display a Messagebox that "No record Found" I try to put a code in a macro builder in a after update property field but nothing happened.
Expression code that it will display the msgbox if there's no record found.
the given code from macro builder is attached. I try to have an if else statement but I dont know how to not equal that giver conditional expression.
What I've done is setfocus from another subform to this subform, and I want to add a new record. I've got my code mixed up somewhere along the line as it's saying "the command or action 'RecordsGoToNew isn't available now.I'm trying to setfocus to this form, create a new record and setfocus to a field within the focussed form.
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 have set up a simplified event booking procedure, similar to the one generated by the access event manager wizard. It uses three tables, one with attendees details, one with the event details and abooking table that links the attendee ID with the Event ID.
The booking table uses commands similar to SELECT[Names + Contacts].[ID],[Names + Contacts].[Surname]FROM[Names + Contacts] to generate drop down lists of surnames and events so that the two can be matched together.
This works fine as a table.
However when placed into a form, whenever the form is opened I get an error message saying the record source specified on the form does not exist.
I have tried regenerating the form, etc. I have used a wizard to generate the form, closed the form, not changed anything in the database and then tried reopening it and I get the error message, can anyone shed any light?
Also if you accept the message then it knows how many records there are, so it must know there's something behind it, also if you change to design mode and then back to form mode, it finds all the data.
I have a table that is filled based on selections that a user makes in combo boxes on a form. I am having trouble trying to figure out the best way to prevent duplicates from being inserted in the table when I do the append query part.
Since the table is filled based on the various selections the user makes I dont have a primary key or unique field.
Can someone help me figure out the best way to do this append/update queries to prevent duplicates. Also if you have a strategy for setting up some sort of unique or primary key for fields that could all be the same yet in the table only 1 record will show, no duplicates.
I have an application written in Access 2007 and packaged using the Packaging Solutions for deployment with Runtime.My problem is that I've written an updated version, and after carefully saving my original Back End away from the install site, uninstalling Runtime and the FE, installing the new FE with a blank copy of the BE having the same name and Runtime, and copying the filled BE into the same folder with the FE (replacing the linked, but empty, BE) I find that SOME of my tables in the BE are not being recognized. This isn't true of all tables. I can open some of the forms and find everything there. In other cases I get the following error message "The record source "tblName" specified on this form or report does not exist."
I currently have this set as the forms default recordsource (which works just fine):
Code: SELECT TOP 5 tblUsers_Phone_Book.EMAIL_ADDRESS, weightedDL('me@mine.com',[EMAIL_ADDRESS]) AS Expr1
And I have this vba to dynamically switch around that email address.
Code: Private Sub Form_Load() Dim intPos As Integer Dim strControlName As String Dim strValue As String Dim sSQL As String If Len(Me.OpenArgs) > 0 Then ' Position of the pipe
[Code] ....
If I msgbox the sSQL - it shows identical to the default recordsource but I get the error:
The error message I get is:
Run-Time error '2580' The record source 'SELECT TOP 5 tblUsers_Phone_Book.EMAIL_ADDRESS, weightedDL('me@mine.com',[EMAIL_ADDRESS]) AS Expr1' specified on this form or report does not exist.
I tried copying the exact working default sql into the vba and get the same result.
I was having trouble adding my records to my subform. I think it was going into my main form, which is unbound. When I removed the navigation bars from my main form and added them back to my subform, I lost my records that i had. They are still in my table, but not showing in my subform. How do I get them in there?
Upon closing my frmInventory the amount stock of stock is checked against a minimal stock value. If the stock amount is below a set minimal value a subsequent form is opened telling you that stock is low and an email message is generated to notify a manager. I have a checkbox on that form which is set to "True" upon close using an update query. The checkbox is there to give users the option to either send or not send a reminder message that stock is low when a message has already been sent earlier.
The problem is that using that update query ALL records are set to "sent=true" and not just the 1 record I intend.
This is my code in the "on close" event:
DoCmd.OpenQuery "qryUpdateEmailMinimal_True
and here's the SQL:
UPDATE tblInventory SET tblInventory.emailSentMinimal = True;
I assume what is missing is a reference to an inventoryID number. How do I do that?
Only just started happening, with no explaination! Only one subform out of 5 shows as just background space until a choice is made from a combo box and then the thing appears with the record. WHY?!?!?! I HATE ACCESS... It's rubbish!! Apologies for my outburst...
I'm a complete newbie at Access. A friend (she's the Secretary of our small town's Service District Board of Trustees) asked me to develop a database for keeping records of property owners here, to facilitate such things as sending the yearly fee letter, tracking mailing addresses and property addresses, whether the fee is paid, etc.
I figured out most of it by "taking apart" a database she uses for another organization. It wasn't easy, but it's all working EXCEPT the thing she uses most: a last name input form (a combo box entry field with a command button) which is supposed to bring up the appropriate "Edit Existing Owner" form by the last name entered (or give an error message if there's no owner by that name, of course). The form works - but simply brings up the last-entered record.
I've looked at the setup in the other database, I see that when I create this form relationship, the VB code is nowhere close to what's in the other database. Trying to use the code from the other database is ineffective, even though the relationship is exactly the same. I'd be happy to have someone look at the forms etc. but the database compressed to a .rar file is 818k which is pretty big - and I'm not sure how to provide just the parts which aren't working.
I can upload the database to webspace and direct someone there if they'd be willing to take a look....
Created a button through button wizard that is supposed to open a form to add a new record, but all of the fields don't clear out. Only some fields clear and other fields actually populate data from another record.
Snip1 shows my form with a record selected. When I click the 'New Waste' button, you can see that the record ID goes to '(New)', but the fields actually populate data from another record.
This even happens if I set 'Data Entry' to yes for the form.
here's the code behind my button:
Code: Private Sub btnNewWaste_Click() DoCmd.GoToRecord , , acNewRec End Sub
I even commented out my code for duplicating my record just in case but that didn't make a different.
Code:
Private Sub btnDuplicateRecord_Click() Dim ctrl As Control For Each ctrl In Me.Form.Controls If ctrl.Tag = "DefaultMe" Then ctrl.DefaultValue = """" & ctrl & """" End If
[Code]....
edit: this problem persists in a backup database that only contains one test record. The button pre-populates data that doesn't exist in the back-up database.
I have table A with a list of Work Instruction references (WIREF) and a Issue number (ISSNO).I have Table B wth employees and they too have a Work Instruction (empWIREF) and Issue number (empISSNO).I want to check if the Work instruction Issue has changed since the employee was trained
check: WIREF = empWIREF and ISSNO <> empISSNO for all records in table B
In trying to respond to another thread, I have run into something that is confounding me (or maybe I'm just getting dense).
We have a subform. One field has an event on DblClick to launch a search form. When the user identifies the target, he/she clicks a button on the subform. This pushes the appropriate value into a field on the original subform using VBA code and closes the search form. This all works fine.
The behaviour that is driving me bugging is when the user clicks on a new record (i.e. new line) on the subform, we would like to automatically generate the next record (E.g. when you type in a field of a record with autonumber in datasheet mode, Access automatically generates the next record). Currently this doesn't happen - Access generates the PK for the record being modified, but doesn't generate the view of the next record.
What really confuses me is that I have created similar looking example in which this works just fine. I can't figure out which of the differences between the two samples is causing this behaving.
Also, typing information into the field on the subform does cause the next record to be generated. It is just doing this via code that works in one case but not another.
I have narrowed it down to the actual subform. Even as a standalone form the form exhibits the same behaviour.
For reference, the original thread is http://www.access-programmers.co.uk/forums/showthread.php?t=99457
I have a database used to track my personal assignments, created about six years ago using Access 2003 on Windows XP. Recently upgraded to Access 2010 on Windows 7. At some point thereafter, I started having the following issue:
When a new record is created, that record gets added to the table, but doesn't show-up in any query, form, or report until after another new record has been added. The most recently added record cannot be located to view or update, except in the table, until after another new record has been added to the table. Queries, forms, & reports now always lag behind by one record.
None of the queries, forms, or reports tested contain filters. I have several multi-user databases that I also support and none of those users have reported having this problem. This is only happening on my personal database.
I've re-created this database once or twice in the past to resolve other issues, but would like to avoid that route this time around, if possible.
So, I have two forms that I am trying to make work the same way.
With F1Entry I can use the combo box in the header to select different request numbers.
With F2Finance I cannot do this. It works if I set the Form Record Source to T2FIN, but when I try to Add Existing Field, something about selector combo box breaks and I cannot select different request numbers.