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
I'm trying to create an access database to make an inventory of my model trains.
I have a main entry form (frmTrain) where I enter all sorts of info regarding e.g. a locomotive. This info is then stored in a table (tblTrain).
In the main entry form, I've put a combo box (cmbCountries) linked to a query (qryCountries) which queries the country codes from a table (tblCountries) that has three fields:
ID (autonumber) CountryCode (short text) (containing the country codes UK, FR, DE, ...) FlagFile (short text) (containing the name of the flag picture, e.g. UK.png)
The flags are stored as *.png files in a folder Flags that is in the same folder as the database file. I have chosen this approach instead of putting the flag pictures in an OLE field in tblCountries because I'd like to avoid being stuck to *.bmp files (don't support transparency). I'd also like to avoid having to mention the complete file path in the field FlagFile
I created a form (frmCountries) to easily add countries to tblCountries as needed.
Now back to the main entry form. The selection made in cmbCountries is stored in the field 'Countries' in tblTrain. When a country is selected in cmbCountries, I'd like that the corresponding flag is displayed next to the combo box.
I found an example on the web where an image field was used to display the flag, let's say with the following code:
Private Sub cmbCountries_Change() Me.ImageFieldName.Picture = Me.cmbCountries.Column(2) End Sub
Private Sub Form_Load() Me.ImageFieldName.Picture = Me.cmbCountries.Column(2) End Sub
and where the combo box had as row source (not using qryCountries):
SELECT tblCountries.ID, tblCountries.CountryCode, [Application].[CurrentProject].[path] & "Flags" & [FlagFile] AS Expr1 FROM tblCountries ORDER BY tblCountries.[Code];
The problem with this example is that, if you select in frmTrain e.g. UK, the UK flag is then displayed across all records in frmTrain. So the image field is not the appropriate field to display the flag in frmTrain and I guess an unbound/bound (?) object frame should rather be used.
How to display correctly the flag picture for every individual record in frmTrain corresponding to the country chosen in cmbCountries.
I am trying to automate a membership status flag based on comparing today's date and a recorded expiry date. The expiry date control is on a sub-form. I have the following code in the OnLoad event of the master form:
Dim DateGap As Integer While Me.CurrentRecord < Me.Recordset.RecordCount If Not Me.NewRecord Then DateGap = DateDiff("y", Date, Forms!PersonalMasterF!MemberSubF.Form.MemberExpire ) Else DoCmd.GoToRecord , , acNext
[Code] .....
With debug pointing to the DateGap = statement I get the error 'Invalid use of Null'. As you can see, I've tried to trap any new records it might run into to avoid nulls in MemberExpire, and there are no null values in the MemberExpire field of the underlying table. I've also tried defining DateGap as Variant, which does not work at all.
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?
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
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 need a flag(indicator) for my database. This flag would be read by many different functions and depending on the value of the flag, would do one of two things.
Example: If the flag is "A", when I click a button in a form it does "C" function. If the flag is "B", then in case of the previous button it will do "D" function.
What I'm having a hard time with is where to store said flag. Mind you the flag is either one or the other ("A" or "B") for the entire database, not just a specific record(s). I thought about adding a field to my 'master' table and then use an update query to change all the values from "A" to "B" as needed, but that seemed a bit like storing redundant data.
there is a function that I wanted to do on my form but can't think of a way what I want to do is to show up a flag after 14 days and 28 days of a date with missed appointment being ticked say there are two fields in the section
hi I was wondering if anyone knows how to flag dates in access. I have 2 dates entered and I need a flag to appear if the second date is a month longer than the first date entered. Hope this makes sense and hope you can help
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?
Hi, just so you are aware, I am totally clueless when it comes to Microsoft Access. I tried finding tutorials and help online that I could use to do this but I'm having trouble understanding what I'm supposed to do. I have two huge tables linked to each other by an ID number. One table contains multiple records with the same ID number while the other does not. There are records in the first table that don't appear in the second one, and there MAY be entries in the second table that don't appear in the first table. The second table has a flag that I would like to add to records in the first table that appear in the second table. What is the easiestt way to do this? This may be an extremely stupid question or it may be very hard, I'm not sure which, though I'm leaning toward it being a stupid question. Thank you in advance for your help.
I print a certificate for each person attending my class by sending the form (StudentForm) to a report . To save time I print and sign certificates for all preregistered students then during class I enter all students that enroll the day of class. What I would like to do is flag each preprinted record so when I select the print button after all students are entered into the database all certificates except the preprinted records will be printed. Any ideas on how to flag a printed record?
I have a list of locations in a sub form where a chart has been and the last record is it's current location. I'm generating a building report which should show a list of charts on that building, but it also shows it on old locations. So in the example, it shows for building 43 and building 83. I just need it to show on 83, how to accomplish this.
I'm aware of the wizard in MS Access that creates a new table containing duplicated entries that have been entered under one column, however, my problem is slightly more complex...
A contractor of mine has recorded information from CCTV surveys of sewers (not very glamorous I know!) in a Microsoft Access database. If you can imagine - the camera can be pushed along a pipe from both ends. Sometimes, the survey is abandoned in one direction and then repeated along the same length of pipe but from the other direction. The database contains (amongst other columns) a "start manhole" reference and a "end manhole" reference. eg:
16014
As you can see, the information contained by both entries will be the same (as they are the same length of pipe). Therefore, I was wondering how I could get MS Access to: 1. Recognise these 2 entries as duplicates 2. Create a table that hides the duplicated entry with a shorter "SectionLength" value.
I need to build a Query that will look at a previous table and a new table and flag any changes...what is the best way to go about something like this?
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.