473,320 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Smart Defaults

Can anyone say what is wrong with this please:
Private Sub Combo18_AfterUpdate()
Dim SQLStmt, R As Recordset
SQLStmt = "SELECT DISTINCT [Height Pixels] FROM [Pictures]WHERE
[Pictures].[Height Pixels] IS NOT NULL AND [Width Pixels]= '" & Me![Combo18]
& "';"
Me![Height Pixels].RowSource = SQLStmt
Me![Height Pixels].Requery
Set R = CurrentDb.OpenRecordset(SQLStmt)
If R.RecordCount > 0 Then
R.MoveLast
If R.RecordCount = 1 Then
Me![Height Pixels] = R![Height Pixels]
End If
End If
End Sub

Control Source for Combo18 is Width Pixels. The idea is a “smart” default
for Height Pixels field, but I just get “Run-time error 438”

Thanks

Peter

Nov 12 '05 #1
1 1510
Maybe I misunderstand, but wouldn't both HeightPixels and WidthPixels be
numeric? You are enclosing the value for WidthPixels in quotes as though it
were a string.

It also appears that you are never setting the value of HeightPixels if more
than one record was returned. Try indenting your code as a reminder to
yourself.

Since you set its RowSource, I assume that the HeightPixels to which you
refer is a Combo or List Box. Could it be that it has the same name as the
Field to which it is bound? A Field, of course, does not have a RowSource.

All of the above are just observations... not related to the error you
experienced. In regards to which, so people don't have to go look up the
description of an error*, it's good to include it. It is also useful to
indicate on which line of the procedure the error occurred. Remote debugging
is difficult at best, but without all the information, it is impossible.

* most, like me, just won't take the time to do so
unless they find the problem very intriguing

Larry Linson
Microsoft Access MVP
"Peter Barker" <pe***@exeter.flyer.co.uk> wrote in message
news:vq************@corp.supernews.com...
Can anyone say what is wrong with this please:
Private Sub Combo18_AfterUpdate()
Dim SQLStmt, R As Recordset
SQLStmt = "SELECT DISTINCT [Height Pixels] FROM [Pictures]WHERE
[Pictures].[Height Pixels] IS NOT NULL AND [Width Pixels]= '" & Me![Combo18] & "';"
Me![Height Pixels].RowSource = SQLStmt
Me![Height Pixels].Requery
Set R = CurrentDb.OpenRecordset(SQLStmt)
If R.RecordCount > 0 Then
R.MoveLast
If R.RecordCount = 1 Then
Me![Height Pixels] = R![Height Pixels]
End If
End If
End Sub

Control Source for Combo18 is Width Pixels. The idea is a "smart" default for Height Pixels field, but I just get "Run-time error 438"

Thanks

Peter

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: BryanEverly | last post by:
Hi, I'm struggling with a problem and was hoping that someone on this group could point me in the right direction. I'm not looking for a free ride, just a suggestion as to how best to use all...
11
by: Ron | last post by:
Hello, I'm having an aggravating time getting the "html" spewed by Word 2003 to display correctly in a webpage. The situation here is that the people creating the documents only know Word, and...
10
by: serge | last post by:
I am doing a little research on Google about this topic and I ran into this thread: ...
8
by: btober | last post by:
I'm finding that column defaults are not being assigned to nulls when I do an insert by way of a an ON INSERT rule on a view. For example, the following script \set ON_ERROR_STOP ON \c...
7
by: Jeff | last post by:
Out of curiosity, I tried to check the help file for the property 'Fetch Defaults' to see what it is for. No surprise, it is not mentioned. F1 on the property give nothing. A search of MS knowledge...
1
by: Bill Menees | last post by:
VS.NET 2003 defaults the "Debugger Type" property to "Auto" for Visual C++ projects. Unfortunately, the "Auto" type isn't very smart. "Auto" bases the debugger type on the launched EXE's type,...
8
by: Axter | last post by:
I normally use a program call Doxygen to document my source code.(http://www.stack.nl/~dimitri/doxygen) This method works great for small and medium size projects, and you can get good...
2
by: stefan | last post by:
Hi, for a school project I'm trying to analyze some python modules. I just struggeld over a little detail I cannot solve: shortened example of walking trough an AST with my own visitor: ...
92
by: Jim Langston | last post by:
Someone made the statement in a newsgroup that most C++ programmers use smart pointers. His actual phrase was "most of us" but I really don't think that most C++ programmers use smart pointers,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.