How can I display the number of records in a database?


After creating a recordset how do I display the number of records in it
Posted On: Monday 22nd of October 2012 05:57:46 AM Total Views:  333
View Complete with Replies

RELATED TOPICS OF Microsoft Access PROGRAMMING LANGUAGE




SetValue Works but record can't be saved

Access 2007 - I have a form and one of the firlds is a Date field named "Last Changed". I have a macro that just uses the Action SetValue for the Last Changed field with Now(). I atached the Macro to the Form Property "After Update". Whenever I change any other field on the form the Last Changed Filed is properly updated with the current date and time but then I cannot advance to the next record. The record will not save and advance. The error when I close the form states that the record cannot be saved. I've made the folder where the app resides a Trusted loaction and have examined the Macro closely for errors. Can anyone help with this
VIEWS ON THIS POST

149

Posted on:

Wednesday 17th October 2012
View Replies!

Run time error 2448; You can't assign a value to this object

Hi all, I have a form that runs from a query which combines data from 2 tables. I am trying to set up a filter on the form using a number of combo boxes and text boxes and a command button to fire it but I keep getting the above error (on the .Filter = strFilter line) and I can't see what the problem is with my code. Private Sub cmdApplyFilter_Click() Dim strSSType As String Dim strArea As String Dim strDepot As String Dim strStatus As String Dim strRisk As String Dim strZone As String Dim strContractor As String Dim strFilter As String If IsNull(Me.cboSSType.Value) Then strSSType = "'Like '*'" Else strSSType = "='" & Me.cboSSType.Value & "'" End If If IsNull(Me.cboArea.Value) Then strArea = "'Like '*'" Else strArea = "='" & Me.cboArea.Value & "'" End If If IsNull(Me.cboDepot.Value) Then strDepot = "'Like '*'" Else strDepot = "='" & Me.cboDepot.Value & "'" End If If IsNull(Me.cboStatus.Value) Then strStatus = "'Like '*'" Else strStatus = "='" & Me.cboStatus.Value & "'" End If If IsNull(Me.cboRisk.Value) Then strRisk = "'Like '*'" Else strRisk = "='" & Me.cboRisk.Value & "'" End If If IsNull(Me.cboZone.Value) Then strZone = "'Like '*'" Else strZone = "='" & Me.cboZone.Value & "'" End If If IsNull(Me.cboContractor.Value) Then strContractor = "'Like '*'" Else strContractor = "='" & Me.cboContractor.Value & "'" End If strFilter = "[subSubstationType] " & strSSType & "AND [subArea] " & strArea & "AND [subDepot] " & strDepot & "AND [subStatus] " & strStatus & "AND [subRiskLevel] " & strRisk & "AND [subZone] " & strZone & "AND [subContractor] " & strContractor With Forms![frmSubInfo] .Filter = strFilter .FilterOn = True End With End Sub
VIEWS ON THIS POST

180

Posted on:

Thursday 18th October 2012
View Replies!

Control can't be edited; it's bound to unknown field 'FieldName'.

, I am trying to input data into a form, the form consist of mulitiple tables. Once I set it up I get a "#Name" error in the text box, and when I try to input data into the text box, at the bottom of the form it keeps saying "control can't be edited; it's bound to unknown field 'FieldName'." Can anybody help me with this problem
VIEWS ON THIS POST

266

Posted on:

Thursday 18th October 2012
View Replies!

DESPERATE:cannot refer to subform control

Still beating my head on the wall. I'm sure it is simple but I NEED guidance. I've made a macro to show a date field when the "Yes" option button is selected and hide it when the "No" option button is selected. I first created it for the form to act on its own --> and it works. Now I want to use that form as a subform in the form [frmTestPkg]. I am having problems figuring out how to reference it properly as a subform. Here's my macro that works when I attach it directly to my form: Condition:[Forms]![frmsubcruiseplan]![CrPlRecvdNo].[OnGotFocus] Action: SetValue Item: [Forms]![frmsubcruiseplan]![CrPlSubmDate].[Visible] Expression:No Location: "On Got Focus" Event for the option button "No" Condition:[Forms]![frmsubcruiseplan]![CrPlRecvdNo].[OnGotFocus] Action: SetValue Item: [Forms]![frmsubcruiseplan]![CrPlSubmDate].[Visible] Expression:Yes Location: "On Got Focus" Event for the option button "yes" I have followed the pattern provided previously of Forms![main form name]![subform control name].Form![control name] but cannot get it to work -- obviously messing up somehow. The reference I tried in the condition looks like this [Forms]![frmTestPkg]![frmsubcruiseplan].[Form]![crplanrecvdNo].[OnGotFocus] --> and with or without the setvalue information included I get a "The object you referred to as an OLE object isn't an OLE object" error. Perhaps I am not identifying the subform control name properly Or maybe I should be referring to the "Cruise Plan Recvd Option" instead of the individual control boxes (but it worked as a form) Please spell it out for an idiot, what this is supposed to look like. Many
VIEWS ON THIS POST

176

Posted on:

Thursday 18th October 2012
View Replies!

Debugger Problem (can't kill break point)

I set a break point in my Main Menu and have since removed it. It was in the ON OPEN paragraph. The problem is that everytime I shut Access down and bring it back up (not simply closing the database) the Main Menu auto starts (as I want), but it jumps into the debugger at that break point. It doesn't show the big dot, but it stops there. I've tried adding a new break point and removing it and I've done a reset. If I close the database and reopen it then it seems fine. However, the next time I shut Access down and start it again the problem returns when I open that database. Any suggestions on this one (Dammit I hate Access sometimes!)
VIEWS ON THIS POST

174

Posted on:

Thursday 18th October 2012
View Replies!

How can you calcaulate general date?

, I have two fields: Ordered and Delivered formatted as general date. I want to know the difference in hh:nn. I tried to build an expression, but it is coming up blank. The fields are named Ordered and Delv_Date. I am looking to have the Time_Calc field calculate once the Delv_Date is entered. Can someone please help me\t I have minimal knowledge in VB.
VIEWS ON THIS POST

140

Posted on:

Thursday 18th October 2012
View Replies!

how can I add a criteria field in a form ASAP

Good day . I'm designing an access system in which I have many reports (Primary Key is reportNumber) I need a form with a field in which I can speicify a range of reportNumber to print them. example I need to print reports from 1000 to 2000 please note than I'm a beginner in this so I need detaild steps. any help will be very much appreciated!
VIEWS ON THIS POST

263

Posted on:

Thursday 18th October 2012
View Replies!

The dreaded "You can't assign a value to this object" error message

Hi Gang, I'm new to this forum so please bare with me. I have spent the last two days trying to resolve, or work out why on earth I am getting this error message. I am at the point of pulling my hair out - its SO frustrating so *any* suggestion would be great. I have created a small database for plant (as in flowers) details. To cut a long story short, its a simple db fronted by a form that allows me to display and add records together with an associated image (stored outside the db). I was trying to write some code that would look at the control that displays the image and, if there is no image associated with a particular record, it would display an "add new image" button. If there is an associated image, the buttons visable property is set to false. I had ammended a section of code for the forms "on current" event and saved the changes. I then changed to form view, tried to enter a new record and access throws up the error message. It does not matter which field I try to add data in, the same error still happens. I have checked, and re-checked all my code and property settings for every control and field on the form and I can not track down what is causing this error. I noticed from searching this forum that someone else had this error but the resolution does not appear to have been posted so can anyone help in any way at all. My grateful
VIEWS ON THIS POST

167

Posted on:

Thursday 18th October 2012
View Replies!

Wierd Prob: Cannot update SQL Server text-fields for some records, but can for others

, I have a very strange problem: I have a table linked to an SQL Server table in my MS Access 2000 Application containing 5 text-fields (SQL Server Type, in Access seen as MEMO-fields) and several other fields (in total about 140 fields). Updating any field works fine except for some records. In those records I can only edit the non-text-fields in my application. When I try to edit one of the text-fields I get a error message telling me that another user has edited the record and i have to discard my changes. The strange thing is that this problem only crops up for some records. (1 in a 100 or so) other records work fine. Does anyone know what happens here And how this can be fixed
VIEWS ON THIS POST

230

Posted on:

Thursday 18th October 2012
View Replies!

Seems silly, but I cant fix the problem

Okay, I know this can not be this difficult. I copied the year end report queries for the next fiscal year. I wanted to save time in creating a whole new report. However, when I go into the design view of the new (copied) query, I can not change the date range with out the date changing on the query from the year before. How do I change the date in the new (copied) query with out it changing in the years before
VIEWS ON THIS POST

217

Posted on:

Monday 22nd October 2012
View Replies!

Access 2007: How can I open all attachments in a table at once?

all, This should be really really easy, but I (and google) just cant get it. I have this huge table of hundred rows, and each row has an attachment. Now i can easily open an attachment on a row, but i need to open all of them. No way am I going to go that line by line. Is there any way to just highlight the attachment column and save all to a selected folder
VIEWS ON THIS POST

242

Posted on:

Monday 22nd October 2012
View Replies!

How can you set a timeout for Application.FollowHyperlink?

Is there any timeout property for Application.FollowHyperlink If there is no way to set a timeout, can anyone suggest an alternative solution I could run the code in a Timed Loop; however, I'd rather use inherant properties to do this is one exists...
VIEWS ON THIS POST

151

Posted on:

Monday 22nd October 2012
View Replies!

How can I subtract two fields from a database table(Table1) in Microsoft Access 2002?

Dear Friend I have two fields under a database table named as Table1 in Microsoft Access 2002. Table1 has got two fields purqty & suppqty which contains numeric values. I want to subtract suppqty from purqty and store result in another field named as balance in Table1. The SQL statement I have written is as follows. But it is not working. SELECT Table1.item, Table1.purqty, Table1.suppqty, Table1.balance FROM Table1 WHERE (((Table1.balance)=[Table1]![purqty]-[Table1]![suppqty])) GROUP BY Table1.item, Table1.purqty, Table1.suppqty, Table1.balance; Please help.
VIEWS ON THIS POST

214

Posted on:

Monday 22nd October 2012
View Replies!

How can I add Subform results?

I have a form which allows user entry then a subform groups together the user entries which works fine. This displays as columns Date, Lamp, Type, Quantity the results are displayed by grouping together by Lamp and Type to display the Sum Quantity for each Lamp and Type for each Date, which is fine. (eg. table like this) Date Lamp Type Quantity 07/08/08 A A 10 07/08/08 B A 5 07/08/08 B B 7 07/08/08 C A 5 Is there a way of adding the Quantites for a Date by selecting the specified Type, (e.g only add together Type A and not Type B), then display in a text box or something under the subform, so I am just getting an output of 20, if using example above
VIEWS ON THIS POST

116

Posted on:

Monday 22nd October 2012
View Replies!

can anyone modify this query statement

hi im a first time user of access, can anyone modify this query statement... select IDno, LName + ', ' + FName as Name, course, Status, (select count(io.AC) from in_out_books io where io.IDno = b.IDno and io.DBorrowed >= '2008/03/01' and io.DBorrowed = '2008/03/01' and io.DBorrowed
VIEWS ON THIS POST

322

Posted on:

Monday 22nd October 2012
View Replies!

Form is lost (cannot open it!)

Today my Access database at work evidently burped! Now when I click on the Form that I want to open nothing happens! The Table still exists with info in it and the Reports still are there but the Form does not open at all.
VIEWS ON THIS POST

133

Posted on:

Monday 22nd October 2012
View Replies!

Access can't open it

This database is in an unexpected state: Microsoft Office Acess can't open it.. This database has been converted from a prior version by DAO. I can not open the database to get at my tables... Help please as I am locked out of my data..
VIEWS ON THIS POST

143

Posted on:

Monday 22nd October 2012
View Replies!

how can i join these tables?

there must be a way to do this, but i haven't been able to figure it out yet... table one has three fields i need to be concerned with, member_ID, range_start, and range_end. no part of any range spanning range_start through range_end will be duplicated. table two has several fields i need, but the field of primary concern is a person_ID that will fall somewhere within a range designated in the first table. how in the world can i join these tables, since none of the IDs in the second table are actually listed in the first, but fall in between values i need to get member_ID from table one, person_ID and several other fields from table two. any ideas
VIEWS ON THIS POST

81

Posted on:

Monday 22nd October 2012
View Replies!

hardcoded parameters in querys--can I find all?

We have a tbldepartments. At this point (has been a few years)...many dept. have merged or changed names. We want to 'change' the names of some and delete or add others. Ok on the delete/add. However, in many of our queries, we have the dept. name/number hardcoded in. And trust me, there are tons and tons of them...this is a big database. Short of going through each query, is there a way to 'search/replace' either in each query or in all To update these easily suggestions
VIEWS ON THIS POST

363

Posted on:

Monday 22nd October 2012
View Replies!

can't insert data into textbox?????

why do i get all the weird problems does anyone have any idea why a textbox would act like it was locked, even though it's not anyway, the text box works fine, until i click my button which goes to a certain record based on my listbox. the code for the click event is as follows: Code: Private Sub cmdFindProcess_Click() blnexist = True Dim rst As dao.Recordset Dim strSearchName As String Set rst = Me.RecordsetClone strSearchName = Str(Me!List26.Value) rst.FindFirst "ID = " & strSearchName Me.Bookmark = rst.Bookmark rst.Close If Me.List26.ItemsSelected.Count = 0 Then MsgBox "Please select your process", vbOKOnly Else Me.formattedtimeelapsed.Visible = True Me.StartTime.Visible = True Me.EndTime.Visible = True Me.btnStartStop.Visible = True Me.btnStartStop.SetFocus Me.StartTimeLabel.Visible = True Me.EndTimeLabel.Visible = True Me.InProcess.Visible = False Me.Current.Visible = True Me.NewProcess.Visible = False Me.hidID.Value = Me.List26.Value Me.formattedtimeelapsed.Value = "00:00:00" Dim Rc As dao.Recordset Dim Db As Database Dim SQL As String SQL = "SELECT * FROM StopwatchRecord Where StopwatchRecord.ID=" & Me.List26.Value & ";" Set Db = CurrentDb() Set Rc = Db.OpenRecordset(SQL) Rc.MoveFirst Me.hidID.Value = Rc.Fields("ID") TotalElapsedMilliSec = Rc.Fields("ElapsedTime") Me.ElapsedTime.Value = Rc.Fields("ElapsedTime") Me.Comments.Value = Rc.Fields("Comments") Me.StartTime.Value = Rc.Fields("StartTime") Me.txtProcessDisplay.Value = Me.List26.Column(3) Me.txtActNumberDisplay.Value = Me.List26.Column(1) Me.Comments.Enabled = False Me.txtAdditionalComments.Visible = True Me.txtAdditionalComments.Enabled = True Me.txtAdditionalComments.Locked = False End If End Sub my guess is that the "bookmark" code is not allowing it. i'm not sure however, how i could find the record any other way, if that is the problem....any suggestions would be greatly appreciated.
VIEWS ON THIS POST

100

Posted on:

Monday 22nd October 2012
View Replies!