combo box troubles

Hi,
I have a form where if a (vendor) combo box field is "null", a msgbox pops up
asking the user to choose a vendor.  After a vendor is chosen, an order form
pops up with the vendor info populated.
All of this is coded on a button:

if isnull(forms!frmInventory.vendor) then
   msgbox "Please choose a Vendor",
   forms!frmInventory.vendor.SetFocus
   *****more code here*****
end if

forms!frmInventory.vendor.value = vendor
docmd.openform "frmOrders"...
vendor = forms!frmInventory.vendor.value
forms!frmOrders.vendor.SetFocus
forms!frmOrders.vendor.text = vendor

what code do I use in the '*****more code here*****' to select a value in the
combo box, then return to the frmOrders?  I've tried OnDirty, ItemsSelected,
AfterUpdate, and others....

Novice to this stuff.....please be gentle :)
Sal

0
mapmaker
6/4/2010 8:14:38 PM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies
1501 Views

Similar Articles

[PageSpeed] 16

mapmaker wrote:
>I have a form where if a (vendor) combo box field is "null", a msgbox pops up
>asking the user to choose a vendor.  After a vendor is chosen, an order form
>pops up with the vendor info populated.
>All of this is coded on a button:
>
>if isnull(forms!frmInventory.vendor) then
>   msgbox "Please choose a Vendor",
>   forms!frmInventory.vendor.SetFocus
>   *****more code here*****
>end if
>
>forms!frmInventory.vendor.value = vendor
>docmd.openform "frmOrders"...
>vendor = forms!frmInventory.vendor.value
>forms!frmOrders.vendor.SetFocus
>forms!frmOrders.vendor.text = vendor
>
>what code do I use in the '*****more code here*****' to select a value in the
>combo box, then return to the frmOrders? 


I don't follow all that, but it seems like you don't need to
do anything there.  You just want the code to exit so the
user can select a vendor in the combo box.

When a user has been selected, then open the orders form
with a filter to the selected vendor.  The code might be
something like:

if isnull(Me.vendor) then
   msgbox "Please choose a Vendor",
   Me.vendor.SetFocus
   Exit Sub
end if

docmd.openform "frmOrders", , ,"Vendor=" & Me.Vendor

In the future, please use Copy/Paste when you post an
expression, VBA code or a query's SQL statement so we can
avoid going back and forth chasing typos introduced by
retyping.

-- 
Marsh
MVP [MS Access]
0
Marshall
6/5/2010 11:57:45 AM
Thanks Marshall, I'll give it a try and I'll copy/paste next time.  Much
appreciated!
Sal

Marshall Barton wrote:
>>I have a form where if a (vendor) combo box field is "null", a msgbox pops up
>>asking the user to choose a vendor.  After a vendor is chosen, an order form
>[quoted text clipped - 15 lines]
>>what code do I use in the '*****more code here*****' to select a value in the
>>combo box, then return to the frmOrders? 
>
>I don't follow all that, but it seems like you don't need to
>do anything there.  You just want the code to exit so the
>user can select a vendor in the combo box.
>
>When a user has been selected, then open the orders form
>with a filter to the selected vendor.  The code might be
>something like:
>
>if isnull(Me.vendor) then
>   msgbox "Please choose a Vendor",
>   Me.vendor.SetFocus
>   Exit Sub
>end if
>
>docmd.openform "frmOrders", , ,"Vendor=" & Me.Vendor
>
>In the future, please use Copy/Paste when you post an
>expression, VBA code or a query's SQL statement so we can
>avoid going back and forth chasing typos introduced by
>retyping.
>

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201006/1

0
mapmaker
6/7/2010 12:08:28 PM
Reply:

Similar Artilces:

Pass combo box value to string variable in module
Hi, In the OK button click event, how can I pass back the selected "me.Combobox1.Value" to my module ? The combo box is in userform. Usually in my module, I define a string variable. e.g sub Test() Dim fname as string ... ... end sub So how can pass the combox value to variable fname in my Test Module directly? Note: I don't want to pass the combox value to cell, and then use fname to read from cell. Thanks. Regards, magix Declare Fname as Public at the top of your module, but inside that General module. Option Explicit Public fname as string sub test() .... ...

Domain Trouble
Hello; Just one more error message to go in order to have CRM up and running fully, and this one has been troubling me for the past month. The error falls under the "Microsoft Windows Operating system" saying "The specified domain either does not exist or could not be contacted." I've looked into it and this is what I have so far: The internet site works ( http://<servername>:5555 ) I can ping the server I'm a Sysadmin under the SQLServer Branch so what am I missing? ....chris This one falls under the "warnings" category and is not an "...

list box #5
I have created an in-cell drop down box that works perfectly, except that it shows blank until you scroll to the top of the list. Is there a way that it would show the first option in the list, rather than start at the end? Are you sure you don't have some blank cells selected in your vaildation? If the cell with the data validation list is blank, and there is a blank cell at the end of the source range, that's what will be selected when the list is opened. If you're leaving blanks so the list can grow, you can use a dynamic name for the range instead. There are instructi...

Publisher is printing jpg as black box
I have inserted a jpg into my document and it appears correctly on the screen but when I print it, it prints as a black square. This does not happen with all jpgs. -- Ron McKie Have you tried printing this image in a different application? If other jpg's do okay, then it could be this image is corrupt. Open it in Paint, save as a different name and try again. Check to make sure you have the most current printer driver. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "RonMcKie" <ronmckie(removethis)@msn.com> wr...

Sent Mail, have mail in sent box not sent by me??
This has now happened two weeks in a row. How can I correct this? My computer is turned off when this is done. Email is being sent to people not in my contact list. Do I have to close this account in order to correct? Is it a Hotmail account? Recent reports of Hotmail Account hijacks http://windowslivehelp.com/solution.aspx?solutionid=1fe6ed3e-eef6-4c57-933f-f3c408f1c5c1 If from another mail service, You can use the above as a guide for the sorts of things to check/change. -- Mike - http://TechHelp.Santovec.us "eve" <eve@discussions.microsoft.com>...

text box margin settings
I've changed the text box margins, saved the file and closed the file. But when I reopen the file, the changes are not there. What gives?!? don The text box margins in an EXISTING text box have changed? Brian Kvalheim Microsoft Publisher MVP http://www.kvalheim.org >-----Original Message----- >I've changed the text box margins, saved the file and >closed the file. But when I reopen the file, the changes >are not there. What gives?!? > >don >. > This issue is unknown in Publisher any version. If you mean it is not saving the defaults on next Text F...

how can i get a box to autocolour to text?
is there a way to get a box in excel to automatically colour itself when particular text is entered into it? Hi, Would you like to expand on what you mean by a 'box' -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "timpatrick2312" wrote: > is there a way to get a box in excel to automatically colour itself when > particular text is entered into it? If "box" equals cell, then check out Format - Conditional Formatting. ...

Publisher font won't hold in text box. DEADLINE
I'm on a client deadline for a newsletter. Original type Arial 14; when retyping/editing text in text box, font switches to Times New Roman and/or Arial 7.5. I block it, specify Arial 14; type in; switches to 7.5. Both Arial and Times New Roman are indicated as embedded. Thank you. -- I would suggest checking the text box settings for the change in sizes. As for the font, check your default printer setting. that might make a difference. -- JoAnn Paules MVP Microsoft [Publisher] "brenda starr" <brendastarr@discussions.microsoft.com> wrote in message news:AC...

Check Box not working when I save as webpage (.htm)
Hi everyone, I have inserted a Microsoft Forms Check box on my visio document. Within Visio, I can check and uncheck this box. But when I save it as a webpage, it can't be clicked. I know why this happens, because it saves the controls as images. But is there anyway around it, or another way I can put a check box on a visio document so that it can be checked/unchecked when it is saved as a webpage. Thanks in advance, Stefano Hello Stefano, The reason the controls are saved as an image in the web output is that they are represented as images in the Visio document itself. You can see ...

Problem showing memo field in list box
I am using Access 2007 in 2002-2003 mode. I have a memo field in a linked table tbl_tasks.description. When I use the Listbox wizard to create a listbox, at the point where the wizard shows me what fields are available to include in the Listbox, it does not show me the memo field. I bypassed that and created the listbox anyway, then modified the rowsource of the listbox to add in the memo field. When I tried this, and when I open the form, Access prompts me for the value of tbl_tasks.description. When I search the newsgroups on this general subject, I see that listboxes generally show a t...

out box error
i get this error on this accouts The message could not be sent. The authentication setting might not be correct for your outgoing e-mail [SMTP] server. For help solving this problem, go to Help, search for "Troubleshoot Windows Live Mail", and read the "I'm having problems sending e-mail" section. If you need help determining the proper server settings, please contact your e-mail service provider. The rejected e-mail address was 'dshipman@shipent.net'. Subject 'ttest shipent.net' Server Error: 550 Server Response: 550 not local host ...

Actual open a file using a Filedialog box 01-21-10
I have the following code in the on click event procedure for a toggle button in access 2003. Dim dlgOpen As FileDialog Set dlgOpen = Application.FileDialog(DialogType:=msoFileDialogOpen) With dlgOpen .AllowMultiSelect = True .Show End With End Sub I want to actually open a file when I clck the open button in the dialog box not return the file file path -- Dave K. ...

Big Trouble with what I thought would be a simple Excel Formula
I want a cell from one column to display the value of the top of another set columns from the highest valued cell of the corresponding row. Is that possible? Makign sure I udnerstadn.. You are in, say, cell A4. You want to have a forula enter the largest value from row 4 in other columns. If that's it, do: =MAX(B4:Z4) "Flip@work" wrote: > I want a cell from one column to display the value of the top of another set > columns from the highest valued cell of the corresponding row. Is that > possible? > > Hi Sean, Thanks for your help. This is the prob...

Activate check box
Is there a way to activate a check box on a double click? Or have a confirming statement "are you sure you want to check this?" Just seems a single click can activate / check it too easy, so easy that you may not notice that you selected it. Let me know Thanks! CB On Tue, 2 Feb 2010 05:46:01 -0800, CB <CB@discussions.microsoft.com> wrote: Typically it is counter-productive to want to change the way Windows works in all applications except yours. In your <checkbox>_BeforeUpdate event you can write: if <checkbox>.Value = True then Cancel ...

Anyone having troubles with Bank One in Ohio?
The online features in M2004 with Bank One accounts in Central Ohio are not working this evening. Anyone else seeing this? -- Aloke ---- to reply by e-mail remove 123 and change invalid to com ...

HIDDEN TEXT BOX IN EXCEL
As part of my job, I am required to perform spellchecks on worksheet pages of excel files (financial statements). These worksheet pages contain many text boxes. From time-to-time I run across a situation where spellcheck will find a misspelled word that does not exist in any of the text boxes that are visible on that worksheet, but may have been visible at one time. I think the problem is that the accountant that created the excel file wanted to delete certain text boxes and thought that he had done so, but never really did delete them. Instead, he deleted the rows contained the tex...

combo box #17
How can set the ListFillRange of a combo box via code instead of using the properties form? Thanks, Kim Is it a combobox from the control toolbox toolbar placed on a worksheet? if yes, then here's one way: Option Explicit Sub testme01() Dim OLEobj As OLEObject With ActiveSheet.Range("a12:c12") Set OLEobj = .Parent.OLEObjects.Add(ClassType:="Forms.ComboBox.1", _ Link:=False, DisplayAsIcon:=False, _ Left:=.Left, Top:=.Top, Width:=.Width, Height:=.Height) With OLEobj ...

Having trouble making a class that serialises how I want..
Hi All I devised an XSD schema for a service offered by a remote company (on a very simplistic level) and used the XSD.EXE to turn it into a suite of classes, the idea being that I can make a library out of them to give to other developers, and the other dvelopers will simply say: service.Address.FirstLine = "1 The Road" service.Address.ZIPCode = "12345" service.Person.Name = "John Smith" socket.WriteString(service.ToXML() ) Or something like this. Now my problem comes when some elements may appear more than once. I was given to understand that I must thus put ...

message box requesting data
Hi All, We have some user using Microsoft Office XP. Sometimes, a message box pop up saying "requesting data from Mircosoft Exchange Server". Does anyone know what does it mean and how to disable this message from appearing? Thanks. Regards, Mayvien >We have some user using Microsoft Office XP. Sometimes, a >message box pop up saying "requesting data from Mircosoft >Exchange Server". > >Does anyone know what does it mean and how to disable >this message from appearing? It means that your Outlook client is waiting longer than usual for your Exchang...

Can a text box use a formula or cell reference
I have a chart that I added a text box which I would like to reference a cell which contains a formula. Suppose cell c25 contains the formula =sum(C2:C23). Is it possible for the text box to reference cell c25? Thanks, Joe M. hi a text box from the control toolbox has a linked cell property and will display the contents of the linked cell. regards FSt1 "Joe M." wrote: > I have a chart that I added a text box which I would like to reference a cell > which contains a formula. Suppose cell c25 contains the formula =sum(C2:C23). > Is it possible for th...

Dropdown box
Hi, i have a spreadsheet, in one row i have several dropdown boxes, i want to copy that row several times, is there a way that the link of the dropdown box to the cell may change automatically without having to get into the "format control" of the dropdown box? Hi I would use a 'Data -Validation - List' listbox. this is easy to copy :-) -- Regards Frank Kabel Frankfurt, Germany Mike wrote: > Hi, i have a spreadsheet, in one row i have several dropdown boxes, > i want to copy that row several times, is there a way that the link > of the dropdown box to the cell...

Tab Generates a Beep on Text Box when Using VS Tools for GP
Hi: I am just getting started with VSTools for GP. I created a very simple from the is accessed off the Extras menu. The form has three text boxes on it (Amount, StartDate, EndDate) against which I have code on the validating and validate events. A code sample is below: Private Sub StartDate_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles StartDate.Validated startDateErrorProvider.SetError(StartDate, "") End Sub Private Sub StartDate_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles StartDate.Validating S...

Text box link
My text box link toolbar is greyed out, even when I select the text box. How do I activate the link? Check to see if "Do Not Autofit" is selected on the format menu, if it isn't, select it. If you are using a text box that has your personal information the link will not work. -- Mary Sauer MS MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Remy" <Remy@discussions.microsoft.com> wrote in message news:4F817895-458E-4546-A5D6-EF38FFC29F03@microsoft.com... > My text box link toolbar is greyed out, even when I select the ...

Assigning Text Box Value to Variable?
Hello all, I have a simple form with a button and text field. All I want to do is press button and the text field value is inserted into the variable. I have done the following:- Dim Subfolder As String Subfolder = Me![Text1] but it returns an error message of 'Object doesn't support this property or method'. Please could someone point me in the right direction. Thank you Graham Your code, as given, works fine in v2003. You don't have another object named "Subfolder" elsewhere in your app, do you? I suppose it could be corrupted. You...

Combo Box Questions
I have created a fill-in form with several combo boxes and some boxes that you just type data in for example the city name because there is too many to type in. So I have this nice data entry sheet for several users who will select their name in a drop down box, then the date (Month, day, year), type of inspection, etc...etc..what I want it to do is when they finish inputting the data I want them to be able to hit the SAVE RECORD command button and it automatically knows what spreadsheet (will be by the inspectors name), to add a new record to. I would do this in Access, but for some u...