A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

On Cick Code needed!



 
 
Thread Tools Display Modes
  #1  
Old August 27th, 2006, 01:37 AM posted to microsoft.public.access.forms
Bob
external usenet poster
 
Posts: 621
Default On Cick Code needed!



I have created a dropdown combo list box (cbOwnerMain) now I want it to open
the owners record form when I click on his name, the form name that the
owners appear on is (FrmOwnerInfo) and the Query is (qryOwnerInfo), I
suppose something on click event!




Thanks in advance.........Bob Vance


  #2  
Old August 27th, 2006, 01:56 AM posted to microsoft.public.access.forms
Larry Linson
external usenet poster
 
Posts: 3,112
Default On Cick Code needed!

If you code at all, check Help on the DoCmd.OpenForm statement and that will
likely be all you need.

If you do not, post back with the name of the owner's name key Field in the
Query for the Form you want to open and someone can likely give you the code
you need to use in the AfterUpdate event of cbOwnerMain.

Larry Linson
Microsoft Access MVP

"Bob" wrote in message ...


I have created a dropdown combo list box (cbOwnerMain) now I want it to
open
the owners record form when I click on his name, the form name that the
owners appear on is (FrmOwnerInfo) and the Query is (qryOwnerInfo), I
suppose something on click event!




Thanks in advance.........Bob Vance



  #3  
Old August 27th, 2006, 02:36 AM posted to microsoft.public.access.forms
Bob
external usenet poster
 
Posts: 621
Default On Cick Code needed!

This is Sql code in qryOwnerInfo:

SELECT tblOwnerInfo.OwnerID,
IIf(IsNull(tblOwnerInfo.OwnerLastName),'',tblOwner Info.OwnerLastName & ' ')
& IIf(IsNull(tblOwnerInfo.OwnerFirstName),'',tblOwne rInfo.OwnerFirstName & '
') & IIf(IsNull(tblOwnerInfo.OwnerTitle),'',tblOwnerInf o.OwnerTitle) AS Name
FROM tblOwnerInfo
WHERE (((tblOwnerInfo.Status)='Active'))
ORDER BY
IIf(IsNull(tblOwnerInfo.OwnerLastName),'',tblOwner Info.OwnerLastName & ' ')
& IIf(IsNull(tblOwnerInfo.OwnerFirstName),'',tblOwne rInfo.OwnerFirstName & '
') & IIf(IsNull(tblOwnerInfo.OwnerTitle),'',tblOwnerInf o.OwnerTitle);
Thanks Bob


  #4  
Old August 27th, 2006, 03:08 AM posted to microsoft.public.access.forms
Bob
external usenet poster
 
Posts: 621
Default On Cick Code needed!

Got it:
Private Sub cbOwner_AfterUpdate()
DoCmd.OpenForm "frmOwnerInfo", , , "OwnerID=" & val(cbOwner.value)
End Sub
Thanks for your help...Bob

"Bob" wrote in message ...
This is Sql code in qryOwnerInfo:

SELECT tblOwnerInfo.OwnerID,
IIf(IsNull(tblOwnerInfo.OwnerLastName),'',tblOwner Info.OwnerLastName & '
') &
IIf(IsNull(tblOwnerInfo.OwnerFirstName),'',tblOwne rInfo.OwnerFirstName & '
') & IIf(IsNull(tblOwnerInfo.OwnerTitle),'',tblOwnerInf o.OwnerTitle) AS
Name
FROM tblOwnerInfo
WHERE (((tblOwnerInfo.Status)='Active'))
ORDER BY
IIf(IsNull(tblOwnerInfo.OwnerLastName),'',tblOwner Info.OwnerLastName & '
') &
IIf(IsNull(tblOwnerInfo.OwnerFirstName),'',tblOwne rInfo.OwnerFirstName & '
') & IIf(IsNull(tblOwnerInfo.OwnerTitle),'',tblOwnerInf o.OwnerTitle);
Thanks Bob



  #5  
Old August 27th, 2006, 10:57 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP]
external usenet poster
 
Posts: 4,231
Default On Cick Code needed!

"Bob" wrote in message ...
Got it:
Private Sub cbOwner_AfterUpdate()
DoCmd.OpenForm "frmOwnerInfo", , , "OwnerID=" & val(cbOwner.value)
End Sub
Thanks for your help...Bob


This line should work just as well:

DoCmd.OpenForm "frmOwnerInfo", , , "OwnerID=" & cbOwner

The Val() function returns the numbers from a string and there shouldn't be
a string in most ID fields. The .value property is the default property of
data controls, so it's unnecessary to use it.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:38 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.