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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using IIF as a control



 
 
Thread Tools Display Modes
  #1  
Old March 10th, 2006, 01:17 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Using IIF as a control

Subform in datasheet view.
"If field 1 contains no data, use field 2, else use field 1"
Field 1 is formatted for date, ie "dd-mmm-yy"
Field 2 is formatted for text

The basic program runs as follows;

Sub Combo69_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Machine] = '" & Me![Combo69] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.List6.RowSource = "SELECT DISTINCT [Masterlist].[Customer] FROM
[Masterlist] WHERE [Masterlist].[Machine] = '" & Combo69.Text & "';"
'Clear entry
Me![Combo69] = ""
End Sub
  #2  
Old March 10th, 2006, 04:01 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Using IIF as a control

Mike,

There are a couple of oddities in your code. For one, I wouldn't use
the Text property of Combo69 in the SQL expression, I think it should be...
Me.List6.RowSource = "SELECT DISTINCT [Customer] FROM [Masterlist]
WHERE [Machine] = '" & Me.Combo69 & "'"

Secondly, setting the value of Combo69 to "" does not "clear" it. I
would use...
Me.Combo69 = Null

But apart from that, I'm afraid I missed the meaning of your main
question. Can you explain a bit more about what you want to do?

--
Steve Schapel, Microsoft Access MVP

Mike DFR wrote:
Subform in datasheet view.
"If field 1 contains no data, use field 2, else use field 1"
Field 1 is formatted for date, ie "dd-mmm-yy"
Field 2 is formatted for text

The basic program runs as follows;

Sub Combo69_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Machine] = '" & Me![Combo69] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.List6.RowSource = "SELECT DISTINCT [Masterlist].[Customer] FROM
[Masterlist] WHERE [Masterlist].[Machine] = '" & Combo69.Text & "';"
'Clear entry
Me![Combo69] = ""
End Sub

  #3  
Old March 10th, 2006, 04:01 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Using IIF as a control

Mike,

There are a couple of oddities in your code. For one, I wouldn't use
the Text property of Combo69 in the SQL expression, I think it should be...
Me.List6.RowSource = "SELECT DISTINCT [Customer] FROM [Masterlist]
WHERE [Machine] = '" & Me.Combo69 & "'"

Secondly, setting the value of Combo69 to "" does not "clear" it. I
would use...
Me.Combo69 = Null

But apart from that, I'm afraid I missed the meaning of your main
question. Can you explain a bit more about what you want to do?

--
Steve Schapel, Microsoft Access MVP

Mike DFR wrote:
Subform in datasheet view.
"If field 1 contains no data, use field 2, else use field 1"
Field 1 is formatted for date, ie "dd-mmm-yy"
Field 2 is formatted for text

The basic program runs as follows;

Sub Combo69_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Machine] = '" & Me![Combo69] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.List6.RowSource = "SELECT DISTINCT [Masterlist].[Customer] FROM
[Masterlist] WHERE [Masterlist].[Machine] = '" & Combo69.Text & "';"
'Clear entry
Me![Combo69] = ""
End Sub

 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically Add User Control Terry Holland Database Design 2 November 28th, 2005 08:48 AM
Data Entry Mode bdehning Using Forms 17 November 22nd, 2004 04:49 PM
How can I move the focus to a control on a subform? Brandon General Discussion 7 July 17th, 2004 01:39 AM
Access Calendar lost General Discussion 2 July 7th, 2004 04:58 AM
AfterUpdate event of Calendar Control in Access 2000 not firing as expected? Gary Using Forms 3 July 2nd, 2004 07:53 PM


All times are GMT +1. The time now is 04:28 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.