Multiselect Listbox On A Subform With Datasheet View
May 22, 2014Is it possible to have a multiselect listbox on a subform with a datasheet view or do I need a combobox in this situation?
View RepliesIs it possible to have a multiselect listbox on a subform with a datasheet view or do I need a combobox in this situation?
View RepliesThis question seems so simple, I feel like the answer is right in front of me. However, I have no idea how to solve this problem.
Essentially, I have a field in a table (or data entry form in datasheet view) that looks up values from a different table. I want the user to only be able to use one of those values, not type in whatever he wants. How do I accomplish this?
See title :)
I have seen that in some sample db's rightclicking the mouse showed the menu with an option to check or uncheck the dataview option, unchecked the formview was applied, but when i 'just' import the subform, i cannot find somewhere the possibility to change from dataview to formview.
Maybe someone can help me with this, probably very simple(?), question?
Hi. I am trying to create subform in datasheet view with one column (total 3)as drop down list. Is this doable? Thanks.
View 3 Replies View RelatedI have a subform that is in databsheet view. When the user logs in to the db it sets the global variable with the group level they have.
I would like a column to be hidden for a certain group of users and have tried the following.
On the subform opening event i have
if vlevel = "engineer" then
me.Hours.columnhidden = True
Else
me.Hours.columnhidden = False
End If
And i have done the same on the Main Form open event identifying the subform by Form!Subform![Hours].columnhidden = True
But neither worked.
Can any suggest something.
Can anyone tell me how to manipulate a single cell in a datasheet view, or if it is even possible?
View 3 Replies View RelatedI have a small issue with the before update event, it is triggered for every record of my subform in datasheet view rather than just once when the user leaves the subform.
I have a module which is called from my form and all the subforms. It tells the user that changes have been made to the record and gives them the option to undo. This is to prevent accidental editing when viewing records. This works fine, but sometimes the user must enter a number of records in a subform and so they must answer the message box every time.
Is there any relatively straightforward way to accomplish the warning and undo when the user leaves the subform rather than the individual record in it?
A quick attempt at lost focus and before exit demonstrated that these were not the way to go.
For reference, here is the before update code and the module
Option Compare Database
Option Explicit
Private Sub Form_Before Update(Cancel As Integer)
On Error GoTo Err_Handler
Call Confirm_Change
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Here
End Sub
Option Compare Database
Option Explicit
Public Sub Confirm_Change()
On Error GoTo Err_Handler
Dim Msg, Style, Title, Response
Beep
'Define message box
Msg = "You have made changes to this record. " & Chr(13) _
& Chr(13) & "Click 'Yes' to save changes " & Chr(13) _
& Chr(13) & "Click 'No' to undo changes "
Style = vbYesNo + vbExclamation + vbDefaultButton1
Title = "Record changed - Confirm save" '
'Check which button pressed
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
MsgBox "Record has been updated with your changes", vbOKOnly, "Record saved"
Else
DoCmd.RunCommand acCmdUndo
End If
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Here
End Sub
I have recently added a subform to a form and wish to display the subform in Datasheet view. Whilst I can get the proper data and headings to display, I cannot figure out how to get the column widths to persist. I can adjust the column widths while in (main) form view right on the subfirm columns themselves but after I save and reload the main & subform form, the widths revert to some sort of default value.
I have also tried adjusting the columns in the subform's associated data table itself as well as adjusting the text box widths when the subform is displayed in Form view but it does not affect the column widths when the subform displays Datasheet view.
What is more annoying is that I have another subform in which I was able to make the Datasheet view column widths persist but I don't seem to be able to properly recall how I did it.
Hi,
I have a query (SelectedData_Query) , on which a form (SelectedDataQuery_SubForm) in datasheetview is based, which is placed on a form (NAWInvoerForm) where customer adress data is put in. When someone clicks new case button on the NAWInvoer_Form, another form (CaseDateTimeInfo_Form) is opened, data is entered, but when the "CaseDateTimeInfo_Form" form is closed, the data in the subform in datasheetview on the NAWInvoerForm is not yet refreshed. So I tried the following:
Private Sub Form_Close()
'------------------------------------------------------------
' RefreshNAWInvoerForm
'
'------------------------------------------------------------
On Error GoTo RefreshNAWInvoerForm_Err
DoCmd.OpenForm "KlantNAW_InvoerForm", acNormal, "", "", , acNormal
DoCmd.RunCommand acCmdRefresh
RefreshNAWInvoerForm_Exit:
Exit Sub
RefreshNAWInvoerForm_Err:
MsgBox Error$
Resume RefreshNAWInvoerForm_Exit
End Sub
Which works just fine. After the form is closed, the name, adress and cases overview form is reopened and refreshed, thus the case that has just been created is shown nicely in the subform which is based on a query.
But it is starting to become bothersome, sometimes when I close the form in which I create a new case, I don't want to have the other form (NAWInvoerForm) reopening again.
So how can i make it so that when I close the form only the data in the "NAWInvoer_Form" is refreshed, without having to reopen the form again. I mean, in the background, the form is still open anyway. It just shouldn't keep popping up everytime.
It can't be hard, but I can't see it. I'm new at this. I have found some similar topics on this forum, but none which helps me out enough.
It should be something like:
On "thisandthatevent" do a "thisandthatcommand" on "thisandthatsubform" in "thisandthatform"
If I know how the syntax of that is done, it would help me out with some other problems I see coming in the near future. I've looked at, and tried some things based on this link: http://www.mvps.org/access/forms/frm0031.htm
But without success.
Can anyone help?
Well, I couldn't find this using the search, so here it goes:I have a form in which I enter data to create a new client. Within that form I have a subform in datasheetview which is based on a query which holds/retrieves certain (important) fields from a table that holds case info. So in that one view the client data is displayed on the form and all cases and the most important data from those cases is displayed nicely in one screen.Now, when a client calls I navigate to that client and see all previous and all current cases that are open and/or closed for this customer. So the customer says case this and that number is the case I need to discuss with you. Now, what I would like is to be able to click or double click anywhere on the line that, for instance, says case nr 55, so that the form(s) belonging to case nr 55 pop up and all info concerning that case is displayed and can be edited as needed. My problem is: I'm still a newbie and if it was a simple thing like using the on_click event to open the form that's needed, I would not have to post this question. But that can't be done (as far as I know) since the subform is based on a query which is displayed in dataview.Am I overlooking a very simple solution to this problem or is it really going to be as difficult as I think it's going to be?For clarification of the idea I have included a screenshot of the form in question. I assume there are tons of databases out there which use such a layout or idea as this one. Please, never mind the buttons etc. It is still a work in progress. ;)
View 12 Replies View RelatedHello, all.
I need to use a datasheet view for a subform, but I can't seem to find how to keep users from editing the column widths within the view. Help?
THANKS!
Tom
I m having a subform in datasheet view. whn i use a join query as the record source for the sub form, i am not able to add or update any record in the datasheet. Is there anyway to use a linked query as record source of the datasheet with editable property.
View 2 Replies View RelatedIs there anyway that we can do cascading combobox in the same datasheet view of subform? Basically I'd like to filter "Account Name" based on "Plan#" selected in the same record of subform.
View 3 Replies View RelatedI have a subform in which I display a table in Datasheet View. The problem is, I cannot figure out how to place the columns in the order (i.e. from left to right) I want.
For some reason, right-clicking on a column header in Form View and selecting Freeze Fields will shift that column to the left but I can find no consistent pattern to it and no other way of shifting a column. Reordering the columns in the table itself seems to have no effect on the order they appear on the subform and moving the controls around in the subform in Design View also seems to have no effect.
I have a subform in datasheet view and a button on the main form which is used to clear all filters in the subform.
The button's OnClick event calls a procedure on the subform. The procedure in the subform has the following code :
Code:
Me.filter = ""
Me.filterOn = false
Docmd.Save acform, subformName
Debug.Print "Filter : " & Me.filter
Me.requery
I also have debug print outs which shows the current filter on the forms OnLoad and OnClose events.
Everything works fine but somehow when I reopen the main form (with subform) the filter gets reset to the previous one.
I can change filters and that saves ok but if I clear filter it always returns to the previous ones when I reopen the form containing the subform...
For reference the filter string in subform looks like "(qrySubformQuerySource.Fieldname)="xx""
I have a subform whose design I am trying to change. When I make changes such as moving fields or adding fields the changes appear in form view (and layout view), but not in datasheet view. However, if I delete fields, the changes appear in both form and datasheet view.
This situation results in behavior where I can have the subform open in design view and toggle back and forth between design and datasheet view, and they are different. However, toggling between design and form view shows the changes as having taken effect.
I have a subform that is in Datasheet view. If I open this subform on it's own, the Date Picker works for the Date field. However, if I open the main form with the subform on it, the date picker doesn't work? Nothing happens when I select a date on the calender.
I am using MS Access 2010.
I have a Project form, which holds StockArtProduction_Subform in datasheet view. I need for them to be able to click on the ID in the StockArtProduction_Subform datasheet and it open a single view form (StockArtProduction) with the correlating ID.
Ideally, it would also work for new entries in the StockArtProduction_Subform, but the StockArtProduction form would have to "auto populate" (did I use it right?) with the ID of the currently open Project form.
Hi everyone!!
This is my first thread in this forum..Hope to get best from this site ..well i m facing a problem..i have a main form and a subform (which is in datasheet view) . Now i have a button called "close_form" in main form on whose click event i have writen this code :
Private Sub close_form_Click()
On Error Resume Next
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Me.Controls.Item("fees sub").SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close
End Sub
1. If i run this form directly from Access and there are no changes i do in the form and click this button then it gets hang after showing error "run time error 2046 ; the command or action undo is not available now " "press End or Debug or help"
2. As i have created a Custom menu, if i run this form from that menu then it does not show any error. But it runs fine for the first time but nothing happens on clicking this button the second time i open the same form ( in same session).
What to do ?? Please help ..
shikha
I have a linked table(tblxyz) having property set as ORDER BY ID DESC, ID is autonumber, so my table view gives me latest record on top.
Now I have a subform , where i am calling this Table.....
[Forms]![MainForm]![Sub_DisplayFm].SourceObject = "Table.tblxyz"
This gives me datasheet view of the table inside subform but its not showing sorted data
Interesting thing is it give sorted data view when my table is not linked and is in same access file.
I have a table, "people" which has all the main data stored. I have another table, "organizations" which I'd like to be able to use on a form to select which organizations people belong to. I created a button on my main form which opens another form on which a listbox with all the organizations shows. What I'd like to do is from the main form, click a button that brings up a new form. On the new form, I can select the affiliations. Then, when I close that form, a box on the main form shows what i've just selected. I got this to work with the listbox, but when I changed it to multi-select it stopped working. Help!! Thanks.
View 5 Replies View RelatedI want to be able to select multiple items from a listbox, click a button, and then print the data related to that item selected using a report.
In the report to print the data, I have added the criteria
[Forms]![Print Labels]![List2]
This is the name of the listbox. However, this doesn't print the items selected in the list box.
Do I have to do this through VBA, or can I accomplish this through a query in the report?
Thanks!
I was wondering whether it is possible to select multiple values in a list box on a form that can be stored in a table.
View 4 Replies View RelatedI have a multiSelect Listbox that has email recipients. I have a command button with Me.emaillist = Null, and after I click the command button the Listbox is still highlighted in black. What VBA command do I create to completely clear the multiSelect Listbox, including the highlighted selection?
losstww
I'm trying to create a database where a single "Classification" field is populated by selections made in a multiselect listbox and I can't figure out how to do this. Any help people can provide?
Table 1:
Name_ID <pk>
Name
Classification
Table 2:
Classification_ID <pk>
Classification
What I want to happen is click on a button next to the Classification field (text) and a popup form with a multi-select list loads (this part is easy, of course). The user can select as many classifications as they want, click the ok button and each item selected then goes back to the first form and populate in the Classification field (seperated by commas or semi-colons).
This possible?
Hi,
I have adapted code from ghudson's example on
'http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=52736
I have a subform called frmsJobPartsUsed, which contains a multiselect list box where the user can select multiply parts used for one job and click a save button, which saves the parts to rows on the same forms (see picture). The user then enters the number used and that number is taken away from the UnitsInStock.
This form is made up of the following two tables;
TblStore
PartNo
PartName
UnitsInStock
ReOrderLevel
Discountinued
Remark
tblPartsUsed
PartUsedID
JobDetailsID
PartNo
PartUsedNum
NumberUsed
The multiselect listbox is made form tblStore, PartNo, PartName and Discontinued = 0
This all works fine so far.
What is need to do is before the parts selected are saved to the table I want to run some code to check
If a part’s UnitsInStock is equal to 0 then Message box saying no stock left need to reorder. It won’t save it to the table.
Or else
If UnitsInStock is greater than 0 but less than or equal to ReOrderLevel
Message box saying Stock running low need to reorder asap.
I have this kind of working but it doesn’t seem to be finding the correct UnitsInStock for the part selected.
Here is the code;
Private Sub cmdAnswer_Click() 'SAVE BUTTON
On Error GoTo ErrMsg:
'Code adapted from ghudson's example on
'http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=52736
Dim myFrm As Form, myCtl As Control
Dim mySelection As Variant
Dim iSelected, iCount As Long
Dim myDB As DAO.Database
Dim myRst As DAO.Recordset
Dim myRstCount As DAO.Recordset
Set myDB = CurrentDb()
Set myRst = myDB.OpenRecordset("tblPartsUsed")
Set myFrm = Me
Set myCtl = Me.lstAnswers
iCount = 0
'Count number of selected records/items
For Each mySelection In myCtl.ItemsSelected
iCount = iCount + 1
Next mySelection
'Check if anything is slected
If iCount = 0 Then
MsgBox "There are no Parts selected..", _
vbInformation, "Nothing selected!"
Exit Sub
End If
StrSQLCount = "SELECT tblPartsUsed.JobDetailsID, Count(tblPartsUsed.PartNo) AS CountOfPartNo " & _
"FROM tblPartsUsed " & _
"GROUP BY tblPartsUsed.JobDetailsID " & _
"HAVING (((tblPartsUsed.JobDetailsID)=" & [Forms]![frmJobs]![JobDetailsID] & "));"
Set myRstCount = myDB.OpenRecordset(StrSQLCount, dbOpenSnapshot)
'SART OF MY CODE TO CHECK FOR UNITSINSTOCK
For Each mySelection In myCtl.ItemsSelected
If Me.UnitsInStock.Value = 0 Then
MsgBox "Out of Stock!" & Chr(13) & "Please returen to Orders or Store to Re-Order Stock. " & Chr(13) & " ", vbOKOnly + vbCritical, "Re-Order Stock"
myCtl.Selected(mySelection) = False
Else
If Me.UnitsInStock.Value > 0 And Me.UnitsInStock <= Me.ReOrderLevel.Value Then
MsgBox "The Store is running low on stock!!" & Chr(13) & " Please return to Orders or Store to re-order as soon as possible.", vbInformation, "Need to Re-Order Stock"
End If
End If
Next mySelection
'END
iCount = 0
'Go throught each selected 'record' (ItemsSelected) in listbox
For Each mySelection In myCtl.ItemsSelected
'Current count of selected items
iCount = iCount + 1
'Print value to Immediate Window
Debug.Print myCtl.ItemData(mySelection)
'Add answers
With myRst
.AddNew
.Fields("JobDetailsID") = Forms![frmJobs]![JobDetailsID]
.Fields("PartUsedNum") = iCount
.Fields("PartNo") = myCtl.ItemData(mySelection)
.Update
End With
Next mySelection
'Requery form
Me.Requery
ResumeHere:
Exit Sub
ErrMsg:
MsgBox "Error Number: " & Err.Number & _
"Error Description: " & Err.Description & _
"Error Source: " & Err.Source, vbCritical, "Error!"
Resume ResumeHere:
End Sub
Private Sub cmdUnselect_Click() 'UNSELECT BUTTON
On Error GoTo ErrMsg:
'Code adapted from ghudson's example on
'http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=52736
Dim myFrm As Form, myCtl As Control
Dim mySelection As Variant
Dim iSelected, iCount As Long
Set myFrm = Me
Set myCtl = Me.lstAnswers
'Count number of selected records/items
For Each mySelection In myCtl.ItemsSelected
iCount = iCount + 1
Next mySelection
If iCount = 0 Then
MsgBox "There are no selections to Un-Select..", _
vbInformation, "Nothing selected!"
End If
'Go throught each selected 'record' (ItemsSelected) in listbox
For Each mySelection In myCtl.ItemsSelected
Debug.Print myCtl.ItemData(mySelection)
myCtl.Selected(mySelection) = False
Next mySelection
ResumeHere:
Exit Sub
ErrMsg:
MsgBox "Error Number: " & Err.Number & _
"Error Description: " & Err.Description & _
"Error Source: " & Err.Source, vbCritical, "Error!"
Resume ResumeHere:
End Sub
Any help would be greatly appreciated.
Thanks in advance
Rita