Hi, I am having some weird problems when using bookmarks. All I want to do is display 1 record at a time in a listbox each time a user clicks a button.
At the moment I save the bookmark value to a global variable, and when the user makes another click is should move to that record. Right now it gives me a "Not a valid Bookmark" error when I click on the button for the second time. First time is alright, but second time it comes up with that error. Any help is appreciated.
Here's an example of my code
Option Compare Database
Dim varbookmark As Variant
Private Sub cmdadd_Click()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
With lstHotel
.ColumnCount = 4
.ColumnWidths = "1in;"
End With
Do While rst.EOF <> True
If varbookmark = "" Then
lstHotel.AddItem rst!Name
rst.MoveNext
varbookmark = rst.Bookmark
Exit Sub
Else
rst.Bookmark = varbookmark
lstHotel.AddItem rst!Name
rst.MoveNext
varbookmark = rst.Bookmark
Exit Sub
End If
Loop
This should be a simple one, but right now I just can't get it. How do I get a Bookmark to pick up on the entry that I chose from in a combo box when there are multiple entries for the same item I want to chose from (ID - primary key is unique, just not the name of the item - 'FullP', and that is what I am using)?
For instance I want to be able to choose the correct record where 'FullP' will have multiple entries, but unique ID's.
Originally I had this bookmark off of a set of cascading combo boxes on a form, but unfortunately when using this set-up the ID (primary key) is not transfered foward, the rest of it works fine and it takes me to the first record for each 'FullP' (just not the correct record when multiples are entered). The record source for the combo is similar to:
“SELECT [LDetails].MDay, [LDetails].Session, [LDetails].DL, [LDetails].FullP “ & _ “FROM [LDetails] WHERE (((([LDetails].MDay)=Forms![DEntries]!EDay) “ & _ “And ([LDetails].Session)=Forms![DEntries]!Session) “ & _ “And ([LDetails].DL)=Forms![DEntries]!DL) “ & _ “ORDER BY [LDetails].FullP, [LDetails].ID;” AND
Dim Rs As Object Set Rs = Me.Recordset.Clone Rs.FindFirst "[FullP] = '" & Me![FullP] & "'" If Not Rs.EOF Then Me.Bookmark = Rs.Bookmark Rs.Close When changing the final combo box and binding it directly to the query, the primary key is transfered foward correctly, but I am still having problems getting it to go to the correct record. I have added:
Dim Rs As Object Set Rs = Me.Recordset.Clone Me.RecordsetClone.FindFirst "[FullP] = '" & Me.FullP.Column(0) & "'" If Not Rs.EOF Then Me.Bookmark = Rs.Bookmark Rs.Close This just takes me to the very first record...
I would really like to keep the cascade combo boxes working. Any ideas?
I have a search form (Form A) that as I type in a text box the contents of the listbox refreshes to show only those items that match the text in the text box. When you double click on any of the items in the listbox it jumps me to a detail form based on the ID field. On the detail form, there is a subform for any notes which uses a listbox (it lists all the notes entered for that detail item).
The notes subform listbox is only displaying the first note entered in the database.... So if I search for information in case 43, I find case 43. I double click on case 43 and the details for case 43 pop up. I go to the notes subform and the listbox showing all the notes entered is only showing the notes for case number 1.
I've found a few posts about this subject, on the forum, so I'm guessing that my database (or at least one table therein) has become corrupt.
I've tried the various suggestions I could find (compact and repair, import into a new Db, etc) and none have worked. I have, however, located a version of the database from the day before this error first occurred. I've checked the problematic table and it contains no 'Error#' lines.
The single table affected contains a lot of data and is pretty irreplaceable. I have daily backups, so no information will actually get lost, but if I can't add any new data to it (for fear of corruption) it won't be much use.
1) What causes this problem? I can't seem to find a definite answer to this one. 2) Is there one definite fix I can use to prevent the problem occurring again?
I tried to search the forums for an answer but I still can't seem to solve the problem. I receive the "Not a valid bookmark" error message when attempting to open my database. I have tried the compact tool through access and also jetcomp but it just brings up the same error message on access and says "error compacting database" on jetcomp. Can anyone provide a solution to my problem in order that i can either open the database or else retrieve data from it? Many thanks, any help appreciated Jon.
I have attached the database in case you have any software which might be of use.
one of the databases at my place has started acting really strange and was wondering if anyone knows what could possibly be wrong?
there's only one big tble holding about 7.5 k records with approx 10 fields
info that was entered yesterday has now been deleted (by access?) and when you scroll down or go down to the end records, all those records that were there yesterday now show either #error or #deleted and then an error popup appears saying "Not Valid Bookmark"
The UID doesn't appear to be working either, i.e it's not incrementing properly?
I have a knowledge base database which lets the user search for articles containing answers to common problems and issues. Some of the users want to be able to bookmark certain useful articles. The DB is a front end/back end design so I am thinking if I have one table stored in the front end which can be used to store that particular user's favourites then that would be great. However, I a little stuck on how to implement this. Ideally, I'd like a simple checkbox option next to each article, which when ticked, would store that article ID in that user's local front end.
Private Sub Form_Current() If Not Me.NewRecord Then With Me.Q_Subform.Form .RecordsetClone.FindFirst "N=" & Me.N .Bookmark = .RecordsetClone.Bookmark End With End If End Sub
The problem is that when the Q_Subform has no records I have the error 3021.
How can manage it. It's the last step before ending My db
Ok....Just when you think it's all running smoothly.... :( I have a combo box, MDLastName, with a column count of 9, with column 2 displaying and all others hidden. The selection made with this combo populates 7 corresponding fields (first name, address, etc). It's working perfectly.
The first problem I encountered was with identical last names, but different corresponding data. When I selected Jones, for example, it would populate the first Dr. Jones and his info, listed in the table. However, if I selected the second Dr. Jones in the combo list, it was still populating only the first Dr. Jones' info. I resolved this by binding the fist column (ID, aka primary key), but still hiding all colums but column 2. First problem fixed..
Next, I have a Word Template document bookmarked to receive data from the form, frmDenial. I have all the coding working fine and dandy to insert the data from the fields on the form, save, and print. However, instead of inserting the text from the MDLastName, it is inserting the primary key (because it is the bound column in the combo box). Now, because of the first problem discussed above, I cannot change the bound column to column 2 (containing the data I need in the Word Template). How can I get the right info to appear in my template with the bookmarks?
Public Sub cmdRequery_Click() Dim vFlag As String vFlag = Me![EncounterNbr] Me.Requery
With Me.Recordset .FindFirst "[EncounterNbr] = '" & vFlag & "'" Me.Bookmark = .Bookmark End With
The user starts on a continous form and opens a record, makes some changes, and then when that form closes it triggers this public sub.
The code does what I want it to do in that it returns to the last encounter number that was selected (now on the continous form again) and it requeries and shows anything that was changed about the record on the form that was closed before requery.......
But it always resorts and moves it and I want it to stay in the same spot unless the user sorts. Is there any way to make that happen?
I understand how to pass text boxes to bookmarked locations in Word, but when it comes to combo boxes, list boxes, or option buttons, I am lost. So, my problem this time is the following:
I have an access user form that is asking the user to input data and make selections. Once entered I am trying to get everything to export directly to respective bookmarked locations in a Word Report. I have my text boxes working and I have the combo box now working. The issue I am experiencing is with the user making multiple selections from a list box and I am not really sure how to get that to export to the word document.
Here is what I have:
Code: Dim strNames As String Dim ctl As Control Dim varItem as Variant 'ensure the user has made a selection from the testers name text box If Me.testersNamesText.ItemsSelected.Count = 0 Then MsgBox "You must select at least 1 Capability Testers Name"
[Code] ....
I am very new to trying to code with the Visual Basic side of things, I know this is probably the best method to do this but the issue that I am experiencing is receiving a Null error for the line with
And when I attempt to pass the strNames in place of the testersNamesText I receive that the user form can't find the field "strNames" referred to in my expression.
I have installed Microsoft Access 2003 and Microsoft Access 2003 Developer Extensions. I can create Access application by using the Package Wizard. But after I upgrade from Microsoft Access 2003 to Microsoft Access 2007. I can't use the Package Wizard.
Hi, I have been using "fSetAccessWindow (SW_HIDDEN)" in the open event of my main switchboard to hide the grey Access screen from being visible behind forms, reports, etc in this db. But when I started using a .vbs script file to launch the db, the Access window stopped being hidden. (The reason I use the script for launching is that it temporarily sets the db's security level to 1 which stops the macro security warning from coming up.) Apparently MS knows about this happening and released a technique to rectify the situation, but I don't understand their instructions. It looks like they expect one to have more understanding than I have. Could someone help me get this impliemented? Here is the article: http://support.microsoft.com/kb/167659/en-us Thanks!
Hi! This is Kishore, working on VB Project which is using MS-Access95 as backend. Now, i want to change the Database login Password. Could anyone guide me in this context.
Using Access's User and Group Accounts or Using a Login Form to access database?
I've been researching on how to make a database secure. How to create User and Group Accounts on access, I see the step by step instructions and tried it out myself.
I also saw some sites where they give an example of a Login Form and how to create one.
My question is do you need to create both. First create the users and groups to permit or deny access to certain forms and then have a login form?
But would that mean that they'd have to login twice? Once when the database opens because it activates the db security that was created and then login again in the login form that was created?
Also when the user logins in and clicks on the cmd button on the form which opens up another from, frmWorkLog, I have an Employee field. This field I want it to have the user's name entered automatically and "locked". So that info, employee name, is extracted from the user's login. So then the user can only see his or her records only and no one elses.
How would I go about creating that. Hope I made my explanation clear.
I have two database applications and they are: - the (A) application is for administration use. - the (B) application is for normal users use.
the idea is that: I made the (A) application for administrators who have full control over the database objects (tables, forms, queries, and so on ...).
the (B) application I have created for normal users who will have only to use forms to insert some data and display data only.
but the two applications has a respective table called "vacation request" table. where I linked them, so the both administrators and users can share the data.
The real question is that: How can I prevent the users from seeing the database objects in their application. I used the database options which have helped me in hidding the database objectives when the users open the application, but unfortunately they managed to access to the database objects by pressing the special keys.
I would like to have an access to the (B) application when I want to make some modifications to the forms and then lock it from users where they only have to use the forms for requesting vacations and view the vacations.
I have a simple access search form , that's based on a query that fill parameters from the form textboxes, when the access form loads its keeps prompting for parameters value which looks ugly .. I want to open the form, displaying all the records in the table and filter when i click search ..
I have a data entry entry form, that i want to generate success message after successful insert in database. I have done it in the button event if no error happens, still if i left all fields blank and clicked save, it displays the message ..
I need to change that to display please fill the textboxes then click save , and display success message when the row is actually inserted ..
I've been using the following code successfully in Access 2003 & now I need to migrate to Access 2010. The purpose of the code is to use the items that the user selects in the list box to build the criteria of a query. Access 2010 keeps giving me a syntax error when I try to run the query & I don't know why:
My code is:
On Error GoTo Err_Command151_Click
' Declare variables Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim varItem As Variant Dim strCriteria As String Dim strSQL As String
[Code] .....
The syntax error I get in Access 2010 is:
Syntax Error in query expression 'SELECT * FROM qryContractListSummarybyDateContract3TYPEBREAK WHERE qryContractListSummarybyDateContract3TYPEBREAK.Rep ortableName IN('Adbri Masonry NSW');'
Attached is a screenshot of the relationships in a database I built a couple of years ago. It's worked absolutely fine in Access 2003 and currently has over 18,000 customers with associated information in it.
However, when I open the database in Access 2007 the performance is awful. All the forms are very slow to respond when tabbing between form elements. I've experimented by reducing the number of form elements calling on related data on a given page and whilst this improves performance it reduces usability - something I don't want to compromise on especially since Access 2007 should be able to cope with this.
My next question is therefore whether I've got the most efficient underlying table design and I can't see any other way of doing it than my current method so I'd be grateful for any feedback or advice anyone has.
I have a stock control database which i have nearly completed. This has Manufacturer, which is linked to products, which is linked to Sub Product(which also has field partCode). i.e. Manufacturer1 can have 3 products, and each of these products could have 5 subsystems and partcodes. Each partcode is unique to that subsystem/product/manufacturer.
I then have a pricing spreadsheet in excel, which has many tabs. A new column has been added for each item for Manufacturer,Product,Subsystem and Partcode.
I need to import these manufacturers,products,subsystems and partcodes, but into the tables with the correct relationships, i.e. product1 and product2 are products of manufacturer1 and so cannot come under manufacturer2, and so on.
I hope this makes sense, Thanks in advance for any help you can give!
I am working on a massave aplication that has been running in Access 2000, but recently several of the file sharing users have installed Access 2003 because of the limited availability of Access 2000. All the users are using the same file off the server.
The problem we are having is that when we reference a subform in the "[Forms]![FormName]![SubformName]![FeildName]" Access 2003 does not recognize it and returns an error. I have found that if I will modify it to "[Forms]![FormName]![SubformName].[Form]![FeildName]" it is recognized in both 2000 and 2003.
To try and change every instance of a subform reference will take forever and I am garuteed to overlook something. We reference subforms all over our program, missing any one of them would be a disaster. Before I went to the tedious task of looking through everything I just wanted to throw the situation out there and see if any of you had any great ideas on how to get it fixed efficiently. I would apreciate any ideas.
I have made a form on access which will be used by other employees within the company, however they have never used access before and they are wanting to access only just the form as I feel with Access and all the tools in the background will confuse them, plus I don't want them editing the data base its self.
Is there a way to only bring up the form, unless I obviously need to edit the date base.
I've done some research on Google and it seems I need to use:
SW_SHOWMINNOACTIVE
However I can not seem to find how I would use this or where?
and also if i did find a way to only bring up the form, how would I be able to switch it from that veiw to the veiw I edit in?
I upgraded a 2000 db to 2003 recently. When I ran the function below it gave me an error on the line in green. Any thoughts? Thanks. Const FIRSTROW = 13
Dim wsp As Workspace, dbv As DAO.Database, tblResolve As DAO.Recordset Dim tblVchs As DAO.Recordset, tblImpTmp As DAO.Recordset Dim ObjXLApp As New Excel.Application Dim FileToOpen As String, WhereCriteria As String, ImportTemp As String, tmpVch As String Dim TotalDupes As Integer, TotalGood As Integer, TotalRejects As Integer Dim TotalBlank As Integer, R As Integer, C As Integer Dim BadSheet As Boolean, ImpFail As Boolean Dim tmp, tmpType, tmpCtr, tmpRsn
If Forms![Import Block Vouchers]![Import Program] = "0" Then MsgBox ("You must select a Program to load.") ObjXLApp.Quit 'Exit from MS Excel Exit Function End If
I have an Access DB that I created in Access XP. It works perfectly when used in Access XP. When used in an Access 2003 environment some of the functions don't work anymore. I have users who use Office XP and users who use Office 2003. Does anybody know how to make this DB work in Access 2003 without having to do wholesale code changes?
I have already changed the security to "Low" to bypass the security feature built in in Jet 4.0 but it didn't help. I might have to uninstall Windows XP SP2 to make it work because I know that the application works in an Office 2003 environment with Windows XP SP1 only. But I'm trying to avoid having to uninstall XP SP2 because it's a pain. Any ideas would be greatly appreciated.
Thank you.
My workstation environment is as follows:
OS: Windows XP SP2 Office: Office 2003 SP1 Jet: 4.0