I have learnt VBA in access 2000, and am now working in a place which uses access 97. I am having some trouble in creating a new record, by memory all I used to have to do is;
Anyone know how to determine in access if a user is adding a new record of editing a current one.
I have two buttons on my for. One is add new record which does the following when clicked...
Public Sub AddRec_Click() 'Add supplier record On Error GoTo Err_AddRec_Click
DoCmd.GoToRecord , , acNewRec SaveRec.Enabled = False ' Disable the save button UndoChanges.Enabled = True 'Enable the undo button DisableSupplierNavigation ' procedure to lock the navigation buttons unlocksupplierfields 'procedure to Unlock the supplier form fields for text entries
SupplierIdUpdate = "" 'Clear the supplier id update string SupplierName.SetFocus 'Set focus on supplier name filed NewSupplier! = True 'Update the test variant for record adding test Exit_AddRec_Click: Exit Sub Err_AddRec_Click: MsgBox Err.Description Resume Exit_AddRec_Click
End Sub
All works fine. However, if we check the NewSupplier! test contents outside this procedure we get =0 instead of -1. Big problem as we can not determine if user is adding a record or editing one.
Any suggestions on how to make these determinations in access?
Dim Connection Set Connection = Server.CreateObject("ADODB.Connection") Connection.ConnectionTimeout = 30 Connection.CommandTimeout = 80 Connection.Open ConnectionString
Dim rs set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "SELECT ItemStatusId FROM Users WHERE UserName = '" & session("UserName") & "'", Connection, adOpenForwardOnly, adLockOptimistic
do while not rs.EOF for each item in rs.Fields response.Write(rs("ItemStatusId")) next rs.MoveNext loop
rs.Close set rs = nothing
Connection.Close Set Connection = nothing ----------
The problem shouldn't be the SQL statement because if I create a query right in Access using that statement it works exactly how I want it to.
When I run the page this is on the page times out and gives me this error: ----------- Active Server Pages error 'ASP 0113'
Script timed out
/eos/quicktemp.asp
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools. ------------
If I remove just the "Do While" loop, the page will run instantly but obviously it won't display what I am looking for.
Complete Access Newbie here. I am trying to create a Customer Complaints / Quality Assurance database and I am pretty much sorted except for one final thing that I wouldn't mind doing.
Because there is often a lot of support evidence with a complaint I wish to add this electronically to a record (it could be a Word Doc, Excel, jpg...etc..etc). So that whenever there is a link to the document to the supporting document on the record.
So really looking for an Add (and Browse for button) on the Form for each record.
I have designed an UserForm in Excel, the aim is to copy selected data from Access (tblIndex) to Excel. The form of the Access database is as following: Country Type Date Index ....... ...... ...... ......
The UserForm contains a ListBox "ListCountry" and a ComboBox "ListType" to select country and type, and a ListBox named "ListCT" with two columns for selected country and type, and two TextBox (TextDateSta and TextDateEnd) for the user to Type in start date and end date. What I want to do is to copy the records of the selected Country, Type, and Index from the start date to end date. I suppose I should use SQL like:
strWHERE, I do not know how to define the condition here. The clause below is what I mean, but it looks weird and it does not work.
Num = LiqForm.ListCT.ListCount For i = 0 To Num - 1 strWHERE = "WHERE tblIndex.Type = LiqForm.ListCT.List(i,0) AND _ tblIndex.Country = LiqForm.ListCT.List(i,1) AND _ tblIndex.Date > LiqForm.TextBoxSta.Text AND tblIndex.Date < LiqForm.TextBoxEnd.Text"
I am getting a type mismatch error when I try to set up a recordset to add a record to. Here is the code:
Dim MyDb As Database Dim MySet As Recordset Set MyDb = CurrentDb Set MySet = MyDb.OpenRecordset("GAME STATUS",dbOpenTable,dbAppendOnly)
I am getting the error at the Set MySet = MyDb.Openrecordset("GAME STATUS") statement. I needed to add some reference libraries to get the Database type to work as Access was just installed on this computer. Is there another library that I need to install to get the recordset definition to work or am I just doing something wrong? Thanks in advance for your help.
In my database I have a list of organizations with a certain goal. If that organization can not hit that goal we have to "reallocate" the left over goal to another organization. As it stands now I have the following fields, Goal (which should stay stagnant), change (to either subtract from one organization and add to another) and New. What I would like to do is have a way to have a way to calculate if there is a change to maybe have a drop drown that when the change is subtracted I can add that to "new" of another organization.
Just a quick question to see if something is possible or not.
Basically i have a form which the users record errors which have happened with deliveries of our product and have to select the reason why this happened. What i have been asked to do is when the users are entering the reason 'incorrect address', they want to be able to click on a button and everything which they have entered for that record are appended to an excel spreadsheet. The are currently entering it twice...once in my database and once in a spreadsheet and they just want to reduce their workload.
This transfer of data is only needed when that specific reason is chosen from my combo box, no other reason. I don't have much knowledge of Excel, i was just wondering if this type of thing wa possible and if anyone could put me in the right direction. I have had a search for my problem, but havn't found anything similar to my pro. yet.
In OPTIONS -> Advanced I have the option Open Database using Record-Level locking ticked.
What is strange is record level locking works on Form1 (Form1.recordlocks= Edited) as long as Form2 has Form2.recordlocks = No Locks. If I change the Form2.recordlocks = Edited, Form1's locking becomes page level locking.
This is even true if Form2 is not open...
Additionally, Form2's locking is always page level locking if Form2.recordlock = edited.
I would like all my forms to perform RECORD level locking not page Level locking. How do I accomplish this.
I've been trying to resolve this issue for about 2 months now but no answers from the community.
I need to build a output text file (edi) with 500 byte records and up to 6 different record formats. Can anyone point me to any information/links that would help me understand how to do this?
I want to save a record with a command button. I am using RunCommand acCmdSaveRecord. Access gives me a prompt saying "You are about to update 1 record. Are you sure you want to update this record?"
I am not a specialist, but am trying to create an application with Access 2000to manage our company’s orders. I have a table called ‘Service’ containing descriptive data on the type of service requested. This table is linked to several other tables, with ‘ServiceNo’ as the primary key linking most of them. The service number is not an autonumber, but a counter incremented through code, for specific reasons that I won’t develop here.
I have created two forms: one to consult all the service records (F_Service_Consult), with a button to open another form that allows the user to add a new service record (F_Service_Add).
When the new service form opens, the service number counter is incremented and this number is assigned as the new 'ServiceNo' in a new record added to the ‘Service’ table (using the SQL ‘Insert’ command). I would like this form (F_Service_Add) to open on this record only. In the code that creates ‘ServiceNo’, the correct value is contained in a variable called ‘lngServiceCount’. I have tried using this code to open my form:
Dim stDocName As String Dim stLinkCriteria As String stDocName = "F_Service_Add" stLinkCriteria = "Forms![F_Service_Add]![ServiceNo]='" & lngServiceCount & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria
When I run the code step-by-step, the correct value is shown for ‘lngServiceCount’ when the mouse hovers over the variable (for ex. ‘155’). When the form opens, I have 1 record (Filtered), but nothing shows in the ‘ServiceNo’ text box.
I have deactivated the code that is in the ‘OnCurrent’ event procedure of this form to avoid any interference.
There are many sub-forms on the main form, which also contain the ‘ServiceNo’ in text boxes.
When I use this command to open the form:
DoCmd.GoToRecord , , acLast
the form opens correctly, with the correct ‘ServiceNo’, but ALL the records are opened.
The variable type for ‘lngServiceCount’ is a long integer. (I hope that is the correct term in English, because I am using a French version of Access).
I would be very grateful if anyone could tell me what I’m doing wrong. I’ve tried to be clear, but if more information is required, I would of course provide what’s missing. Thanks in advance.
Hi, I am working on Forms and subforms in Access. I have a main form, a tab control on the main form, 5 pages on that tab control,a subform on each page and many controls on each subform. Main form's Record Source is maintable and all the subforms have the same Record Source subtable. maintable and subtable have one-to-many relationship. The Navigation Buttons property is set to Yes for the main form as well as for all the subforms. Now here is my problem: I want to view the same record on all the subforms at a given point of time. For example: I go to page1 and navigate through subform1's records and I stop at 4th record and then I click on page2, there I should see 4th record on subform2 and if I click on page4, subform4 also should display 4th record. In other words, whenever I stop at nth record on a page-X all other pages should display nth record. Any help would be appreciated.
Hi All - I'm developing a database that requires records to be entered and updated. When updating records, the user must select an item from switchboard (Update a Record) which takes them to a screen/form where the user can enter the record number. When the record number is entered and the user clicks on the "OK Button" I need one of two actions to occur ... (1) the user is taken to the record for updating or (2) the application returns a message "Record Not Found".
Can anyone tell me how I can code this?
At this time I get a message that my form name is not recognized within the expression I've "built" in the macro.
If anyone can help me it would be greatly appreciated before I go bald from pulling my hair out!!
When I click the button "open new order" after that my form it's open with new id and it's ok, but when I push the key "F5" then Ms Access goes to another record (no new record). Why is that?
I am trying to create a database to record employee sick leave and to indicate when an employee has surpass they allotted sick leave yearly.
I have the following tables and attributes
Employee Table ID#, FName, MInitial, LName
Status Table Category Allocation
Transaction Table EntryDate StartDate
EndDate TotalDays Certify? DaysBalance
Category indicates if a person is Temporary, Appointed or Substitute and Allocation indicates how many sick days is allocated per category yearly. I place both in the same table so when the status is selected the allocation is autofill
I am thinking of creating a form with the Employee Table info at top and a subform with the status and the transaction information.
I would like when a new year begins the sick days not used is discarded and a new allocation of days per employee is generated also when an employees status is change how to deal with that. When an employee used all of there sick days is there a way to have all those names display when you open the database.
I have an access form that has a marco button to open another form using a filter that returns records in the new form that have a matching recordID field from the main form. This works fine.
I want to be able to add records to the table which works as well only the recordID field is not populated with the id field used in the filter from the main form. How can I populate the recordID field with that of the master filed from the main form? It is just blank on the new records created now.
I have some security issues going on all of sudden. I now have 2 Record locking information files on my drive. I have several users sharing the database. Any clues why this is happen?
Hi. I need help and I needed it fast. I have a small access database which i want to creat a web front end for. I have already created a Data access page and it works fine apart from one important thing. When I open the Data Access page it loads the first record on the list. As this page going to be Add only I dont want to view any record apart from adding. therefore when i open the page it should be new blank record, ready for input. i have looked everywhere but cant find a solution for it. pleeeeeeeeeeaaase help. i appreciate any help given. thanks:confused:
I was wondering if there is an awesome way out there somewhere to take a record and export it into a word document, like a template and have the fields go where you want them to?