Here is an odd thing that perhaps someone can help with. In an immediate window, type the following:
? 22.8 - 22.6
What you get is 0.199999999999
Now, it may have been a long time since my last math class, but I still can't help but to expect the answer 0.2.
Anyone know why this happens...
It seems like CurrentDB (which is a method on Application), rather than being a global object itself, is newly regenerated as an object reference every time it is invoked. I guess that makes some sense in the case that the application might utilize multiple databases, so the "current" one...
Golom,
My guess is that it is the local reference to the database (via db) that makes the difference. Does this modification to your code still work?
Private Sub Command16_Click()
Stop
Dim f As DAO.Field
Dim db As DAO.Database...
Golom,
This gets me one step further, but the variable still seems to immediately go out of scope. For example:
Dim f As DAO.field
Set f = CurrentDb.TableDefs("tblEquipment").Fields(0)
Debug.Print f.name
...gives an "Object invalid or no longer set" error (runtime, 3420).
Thoughts?
-- Jeff
Hello all,
I have been running into two problems that have me completely stumped, and I am hoping someone can offer an answer for one or both.
The first has to do with creating controls programmatically. For some reason, when I try to add controls to my form (in design view), it comes back...
How about something like this:
Public Function IsNum(ByVal InVal As String) As Boolean
IsNum = (StrComp(Trim(InVal), Val(InVal), vbTextCompare) = 0)
End Function
You could set each function up with arguments regarding how far along the track of functions to follow and where to start. For example:
sub CallingSub()
Dim n As Long ' Number of subs to call
Dim m As Long ' Starting point of subs to use - 1
...
SubSub1 n + m, m
...
end sub
------...
Well, one simple solution would just be to call the next subroutine from within the previous instead of the original. In other words, 1 calls 2, 2 calls 3, 3 calls 4, etc. That way, if the original calls 3, it will get 3 and 4 but not 1 and 2.
-- Jeff
I have an application where I need an autocomplete combo box that is capable of holding a lot (like 10^5 or 10^6) of entries. Up to this point, I have created my own ActiveX control, based upon a standard combo box, and simply filled it in with small subsets of data for display purposes. It...
Forgot to mention - I am avoiding SP's because I have been designing the application (which is pretty much single user, btw, but may be multi-user in the future) to work with multiple db servers with only very minor changes to the VB app (like just changing the connect string).
-- Jeff
Thanks for the feedback.
The other question, now, is what happens when I need to do this a few hundred or few thousand times. One way I have an open recordset with which I can loop rst.AddNew's, the other way I have to send multiple commands to the server (of course, it may be that the ODBC...
I have VB code that accesses a MySQL database, and am hoping that someone can educate me on the following issue. There are two methods that are immediately obvious to me (although I am sure there are many others, probably more clever) for updating the database. The first is to open a...
Here is an odd situation. I wrote a piece of code to open a new recordset. Starting with a previously opened connection:
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = ConnString
MyConn.Open
the code to open the recordset looks like this:
Set rst = New...
Excellent solution, Hypetia! I never knew about CopyMemory.
Let me ask a follow-on. Since my control will not know the number of array elements until each is added (except when I load them from a recordset, when at least I know how many will be added as a group), is there any reason this...
Thanks for the responses. A question for each:
Sheco - The only problem I see is that it seems that I would no longer have an index to permit a binary search. Can you think of another way to quickly zoom in on an entry of interest with such a UDT?
Golom - It seems that I would have a similar...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.