I search a record with values that I am taken from form1 .
If i found the record i show it on the form2 else I add a new record to table with values that i am taken them form form.
this is my code:
Code: Dim stDocName As String Dim stLinkCriteria As String stDocName = "mainhazineh_m" DoCmd.OpenForm stDocName, , , stLinkCriteria Form_mainhazineh_m.mahp.Value = Form_mainform_m.Combo2.Value Form_mainhazineh_m.salp.Value = Form_mainform_m.Combo0.Value Form_mainhazineh_m.RecordsetClone.findfirst "[salp]= " & Form_mainform_m.Combo0.Value & " And [mahp]= " & Form_mainform_m.Combo2.Value & " And [shahrp]= '" & Form_mainform_m.Combo12.Value & "'" If Form_mainhazineh_m.RecordsetClone.RecordCount <> 0 And Form_mainhazineh_m.RecordsetClone.NoMatch = False Then Form_mainhazineh_m.RecordsetClone.edit Form_mainhazineh_m.RecordSelectors = True Form_mainhazineh_m.Bookmark = Form_mainhazineh_m.RecordsetClone.Bookmark Form_mainhazineh_m.RecordsetClone.Update Else Form_mainhazineh_m.RecordsetClone.AddNew Form_mainhazineh_m.mahp.Value = Form_mainform_m.Combo2.Value Form_mainhazineh_m.salp.Value = Form_mainform_m.Combo0.Value Form_mainhazineh_m.shahrp.Value = Form_mainform_m.Combo12.Value Form_mainhazineh_m.RecordsetClone.Update Form_mainhazineh_m.Bookmark = Form_mainhazineh_m.RecordsetClone.LastModified End If
my problem is that when i must add new record to db, it only change the first record of table with values that i make them red then add a new record that all fields of it is empty.
can anyone help me ?
I have a form with two textbox, when I type something in textbox, the second textbox is filled with database query "SELECT MAX...", this works in one PC but doesnt work in other...
I have to tables. one dummy and one main. The have the same fields. the dummy is filled by a form. i want to see where they are diffrent. But the query shows all the dummys records. I just want it to show the record that doesnt exists in the main table.
SELECT DISTINCT AttendenceDummy.MeetingCode, AttendenceDummy.EmployeeCode FROM Attendance INNER JOIN AttendenceDummy ON Attendance.MeetingCode = AttendenceDummy.MeetingCode WHERE (((AttendenceDummy.EmployeeCode)<>Exists (select Attendance.EmployeeCode from Attendance )));
I have a tab control with buttons nested inside of it calling to open a form - but when I go to test the buttons, they do not open the form that the wizard selected. I get the error message: invalid outside procedure. If i copy the button into the main portion of the form outside of the tab control - it seems to work. Any ideas would help. Thanks again!
I am wondering why access does not follow its own code all of the time?
For example I have passworded forms following the tutorial on the Microsoft site. It mostly works when the participants fills in the wrong password we will get an error message box and when they cancel the password dialogue box it wont let the person enter the form - but not all the time. Sometimes if you press cancel it still opens the form anyway (without requiring the correct password).
This is similar with the module that I put in to prevent people from using the mousewheel to leave their record etc. Most times it works but sometimes it just isnt called on form load.
There is nothing wrong with any of these codes and when they work they work well but I cant seem to rely on access to do what is supposed to?
I have date picker which works correctly in form. When I put that form as subform to reports header calendar shows up but after selecting date on calendar textbox stays blank. Format of textbox is Short Date, Show date picker property is For dates.
I have the following code which is supposed to insert a new record into TBLLetterHistory when a report is printed. The report is based on a Query which selects the records based on their postcode.
What actually happens is that only the first record in the query is inserted into the History Table. Any suggestions would be gratefully recieved as I have no idea, even after long searches in this forum!!
Private Sub Report_Activate() Flag = 0 End Sub
Private Sub Report_Deactivate() Flat = -1 End Sub
Private Sub ReportFooter_Print(Cancel As Integer, PrintCount As Integer) Dim dbs As DAO.Database, rst As DAO.Recordset Set dbs = CurrentDb() Set rst = dbs.OpenRecordset("TBLLetterHistory")
Flag = Flag + 1 ' If the current value of Flag = 1, then a hard copy of the ' report is printing, so add a new record to the history table. If Flag = 1 Then rst.AddNew rst!ReportName = "RPTLetterByPostcode" rst!Date = Now rst!LeadID = [QRYLetterByPostcode.LeadID] rst.Update rst.MoveNext ' Flag = 0
I have tried to put an Event Procedure on the AfterUpdate (or OnChange) of the Combo Box, and i wrote in it:
------------------------ Private Sub COFNumber_Change() ' Find the record that matches the control. Dim rs As Object If Me![BillNumber] <> Null And Me![BillNumber] <> " " Then: Set rs = Me.Recordset.Clone: rs.FindFirst "[Bill Table_CustomerName] = '" & Me![BillNumber] & "'": If Not rs.EOF Then Me.Bookmark = rs.Bookmark End Sub -------------------------
I try the form, and i get the following message:
"Update or CancelUpdate without AddNew or Edit"
I dont know what this means, and i dont know how to get it working. Anyone has an idea?
Is Query of 'RecordsetClone' possible? (.mdb database on desktop/laptop - single user - no servers) I want to run an update query on a form's underlying query/filters in VB - i.e. the RecordsetClone. I cannot use the query for the form as the fields used by the query have been changed. Logically, what I need to do is below, in the code fragment. Set rst = Me.RecordsetClone Set qdf = dbs.CreateQueryDef("", "UPDATE rst SET rst.Checked = " & bool & " ;") qdf.Execute Microsoft Jet doesn't recognize 'rst' in the sql statement, and this fails. Travis
below is the code I am using to update multiple records on a sub form so that QtyReceived=QtyOrdered when you click the ReceiveButton, now my understanding of VBA is a little limited and the code I'm using won't work in my main form "frmReceiving" only in the subform "frmReceivingSubform" can anyone see what I'm doing wrong?
Private Sub ReceiveButton_Click() Dim rs As DAO.Recordset
Set rs = Me.frmReceivingSubform.RecordsetClone
With rs
.MoveFirst
Do While Not .EOF If rs("QtyReceived") = 0 Then .Edit rs("QtyReceived") = [QtyOrdered] .Update End If .MoveNext Loop
When attempting to select a letter in a form copied from the Northwind's Customer Phone List Form, I am now getting an error message that says "The object doesn't contain the Automation object "RecordsetClone'". I never had that problem before. Appears to be something in the Option Group that has gone awry, but I cannot access the Visual Basics behind the Macro. Is there a way to suppress this message? It does not appear to be a problem in bringing up the sought after page. :confused: :confused: Please help!!
I am struggling here with something that I am sure is simple but for the life of me can’t crack it. :confused:
I have a table and a subsequent query which shows golfers lowest score on each hole throughout the season. I want to add up the total of each hole by individual membership number and display it as a total for each row
I have attached a sample db with a sample query called 'eclectic latest working'. If you look at this query, I want to have the total of every row.
If you look at my form, the total I have at the moment isn’t correct, it is adding up the whole columns (I think)
If anyone can point me in the right direction, I would be most grateful !!
My membership database has worked fine until recently. Now I cannot save inserted data. On attempted saving "Update or CancelUpdate without AddNew or Edit" appears.
The problem. relates to 2 tables Member and Addresses. PK in the parent table Member is ID. In the Addresses Table the FK is ID. There is a One to One relation between the tables and Referential Integrity is set. I know 1 to 1 is not good but it worked fine in this small database.
What would trigger an error to occur if there has been no changes to a DB.
My error # is 2427 (You entered an expression that has no value).
This error occurs when I click on a command button to open a report. When I debug, it sends me to an IF statement that I have loaded in the On Format of the report.
This worked perfectly fine before - the If statement is simple, if a value is true, then it changes a box to bold and if the value is false, the box in the report remains the same weight.
I am not understanding why it is saying that I have entered an expression with no value when the IF statement reads both the true and the false of a chkbox and adjusts the box accordingly.
Can someone explain why this is occuring? Im litteraly stuck.
I just posted something about the calendar2k. Does anyone know where I can find that calendar add on? I know there are others out there but this one was awesome. It was 2 little buttons that dealt with start date and end date. You would just change the OnClick, so when the person clicked it or double-clicked it, it would enter the date in the correct control for you.
I have a query which picks picks up all records from a table. One field however seems to randomly not pick up data from certain records even though the data is in the table.
This has been puzzling me for some time now, does anyone have any ideas / suggestions?
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 am creating a database to store employee data, its divided among 3 tables, storing :Employment data,Personal data and Payment data, the 3 tables are related using a 1-1 relationship between the common field ID in each. I`ve created a form through which all data needed for the fields in each table is entered,while entering the data its possible to view the records, however, when i close the form and check the tables, the data is going to the respective tables,however,after i open the table and then go back to the form, its not possible to view the records in the form, they`re still in the table but i cant view them through the form, i can still add new records using the form, but i`m not seeing the old records anymore. Anyone, help?
I am creating a database to store employee data, its divided among 3 tables, storing :Employment data,Personal data and Payment data, the 3 tables are related using a 1-1 relationship between the common field ID in each. I`ve created a form through which all data needed for the fields in each table is entered,while entering the data its possible to view the records, however, when i close the form and check the tables, the data is going to the respective tables,however,after i open the table and then go back to the form, its not possible to view the records in the form, they`re still in the table but i cant view them through the form, i can still add new records using the form, but i`m not seeing the old records anymore. Anyone, help?
the following error message appears when trying to access my database. I can't seem to get into it at all, not even by trying to import the data tables over into a new database. the following message appears:
"The database has been converted from a prior version of Microsoft Access by using the DAO Compact Database method instead of Convert Database Command on the Tools Menu. This has left the database in a partially converted state. If you have a copy of the original format use the convert Database on the Tools menu to convert it. If the original database is no longer available, create a new database and import your tables and queries to preserve your data. Your other database applications can't be recorded''..
the copy and the back up wont let me in either, this just suddenly happened.
We are creating a simple database to maintain driver license information for faculty, staff, and students who use cars from the university’s motor pool.
To do this, I have created two tables: tblDRIVER and tblLICENSE.
The fields in tblDRIVER are: pkfDriverIndex strLastName strFirstName strInitial strAddress1 strAddress2 strCity strState strZIP datBirthDate
The fields in tblLICENSE are: pkfUpdateIndex fkfDriverIndex datDateUpdated strState strLicNumber datExpirationDate ynViolations ynActive
Information about the driver is stored in tblDRIVER and the driver’s license information is stored in tblLICENSE. Periodically, we run a report that identifies drivers whose licenses are due to expire within a certain number of days. All this works fine.
My problem is that I am trying to create a lookup form that will load from a data entry form that will permit the Motor Pool Clerk to look up a driver by name and review the licensing information (which appears as a subform).
All this sort of works- I am using a combo box (based on a query) to look up a driver’s last name (which it does) and to populate all the driver’s information on the look-up form (including license information in a subform). Currently, the combo box locates the driver (including the unique index, last, and first names), and populates the form with first and last name but the rest of the information is not displayed on the look up form. Worse still, sometimes one driver’s last name matches up with the first name of the next driver listed in the table! This seems to happen only if a look up is attempted more than once. What gives.
Hey guys, i have an access project for my computer class, and considering i dont know much about access, i think i did ok, but i want to make sure everything is the way it is suppose to and do it myself than paying someone else to do it for me.(its some pretty interesting stuff actually) so can you gurus, let me know if what the email from my teacher said is what i have done? i think its just the relationships that might not be done right if anything. i attached the pdf file that says what i must do, and the access file that i made. thanks for all your help in advance guys, Quote: Originally Posted by Kush's Prof there is nothing to make the relationships work. you are simply confusing the operational aspect of the database adn the design aspect of it.
When you program an interface to use it then you worry about usade of the relationships. Setting them up at the design level where you are now, will simply ensure that the relationship is not violated when it is programmed. That is it.
I am trying to get a blank ribbon to be in place when a user opens my application. I have an Adp linked to SQL Server. If I create a table in SQL Server named ribbons and have the app read the data in that table in the AutoExec macro (this runs the code that reads the data) then assign the new ribbon to Application.LoadCustomUI RS("RibbonName").Value, RS("RibbonXml").Value it works and the blank ribbon is displayed. The problem is that this is no use because if the adp is not connected to the database on startup it causes an error as no connection has been established.
Instead I have put exactly the same xml file into a module but this does not have the same affect even though I call the same Application.LoadCustomUI method. I havent really done anything different except change how the xml is found. The problem with this method is it just pops the new ribbon into the list of available ribbons so then the user would have to choose the ribbon, shut down and restart, that is no use.
Has anybody got any idea what can be done about this? I will post the code below.
Thank you for any advice on what can be done.
Paul
First method (which works but is no good for distributing the app)
Autoexec calls the following Public Function LoadRibbons() Dim RS As Recordset Set RS = CurrentProject.Connection.Execute("SELECT Ribbons.RibbonName, Ribbons.RibbonXML FROM RIBBONS") If Not RS.BOF Then Application.LoadCustomUI RS("RibbonName").Value, RS("RibbonXml").Value End If RS.Close Set RS = Nothing End Function
but using the following and calling it in autoexec just puts the ribbon in the list and doesnt use it
Function CreateRibbon() Dim xml As String xml = _ "<customUI xmlns=""http://schemas.microsoft.com/office/2006/01/customui"">" & vbCrLf & _ " <ribbon startFromScratch=""true"">" & vbCrLf & _ " <officeMenu>" & vbCrLf & _ " <button idMso=""FileCompactAndRepairDatabase"" visible=""false""/>" & vbCrLf & _ " <button idMso=""FileOpenDatabase"" visible=""false""/>" & vbCrLf & _ " <button idMso=""FileNewDatabase"" visible=""false""/>" & vbCrLf & _ " <splitButton idMso=""FileSaveAsMenuAccess"" visible=""false""/>" & vbCrLf & _ " </officeMenu>" & vbCrLf & _ " </ribbon>" & vbCrLf & _ "</customUI>" Application.LoadCustomUI "BlankRibbon", xml End Function