473,401 Members | 2,068 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,401 software developers and data experts.

Dmax switched value from string to number(long)

Hello All,

The code below worked when wjem the DrawingID was a text, i switched it to a number now my database went to S**T. I am an engineer and new to coding and need to get this out the door today, or its my ass. Anyone have any suggestions? I have allready tried Dim MaxComponentID As long and Dim MaxComponentID As variant. Any other sugestions? I am not sure if this maters the format for drawing ID is 00 Long Interger. Code below

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command14_Click()
  2.  
  3.     Dim AssyIDvalue As String
  4.     AssyIDvalue = Me.AssemblyID.Value
  5.     Dim MaxComponentID As String
  6.     MaxComponentID = DMax("DrawingID", "Assemblylog", "[AssemblyID]='" & AssyIDvalue & "'") + 1
  7.     Forms!frmAddComponent!DrawingId.Value = MaxComponentID
  8.     DoCmd.GoToRecord , , acNewRec
  9.     stDocName = "frmSubAssemblylog"
  10.     DoCmd.Close acForm, "frmAddComponent"
  11.     Forms!frmstorage!Text0.Value = AssyIDvalue
  12.     DoCmd.OpenForm stDocName ', , , stLinkCriteria
  13. End Sub
Dec 15 '10 #1
2 2389
MikeTheBike
639 Expert 512MB
Hi

When using a string/text field in a ciriteria (where) expresion the argument needs enclosing in apostrophies, as you have done so far.

However, for a number field the argument does not need apostrophies, ie.

MaxComponentID = DMax("DrawingID", "Assemblylog", "[AssemblyID]= " & AssyIDvalue ) + 1

HTH

MTB
Dec 16 '10 #2
NeoPa
32,556 Expert Mod 16PB
If you look at line #5 you'll see the variable you store the result in is Dimmed as a String.

It's always a good idea to keep all your (procedure) Dim statements at the top of your procedures. That way such things aren't so well hidden.

If that doesn't resolve your problem, then I suggest you tell us more accurately what your problem is. Saying something has gone to S**T is unlikely to shock, but it isn't very helpful for communicating information either. At this point all we know is that something, somewhere, isn't working for you. Knowing what that is, and especially where it occurs, would be much more helpful in allowing us to resolve this problem for you before it gets too late.
Dec 16 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jack | last post by:
Hello, What function can get a string's long by JavaScript? Thank you
5
by: ferran | last post by:
Hi, I'm trying to convert a string to a long double using streams but for some reasing seems to give the wrong values, the idea is to do a precise textual conversion without roundings or...
2
by: mp | last post by:
How do i cast a string from sql to a long? lDocumentVersion is long, oSqlDR.GetValue(0) returns a string. lDocumentVersion =oSqlDR.GetValue(0); Thanks
3
by: Chua Wen Ching | last post by:
I have a problem. But on .NET 1.1 My Scenario: Actually I will have a string of hexadecimals read from a xml file. Then from the hexadecimals, i will add 1 value whenever i made any...
1
by: wesbird | last post by:
Hi, I am new here. Please forgive me if I ask some question already got answered. I do search forum first but I did not find the answer. here is my question, in VB you can convert a string to long...
3
by: eddie wang | last post by:
The sqlStr string is too long in the following example and the ASP doesn't work. What is the work around? If using post method, any simple samples? Thanks. <a...
19
by: John | last post by:
Hi How can I convert a string to long value? Most objects have a toString method but strings don't have a toLong method. Thanks Regards
3
by: Water Cooler v2 | last post by:
What is the .NET equivalant of the VB function String(Number as Long, Character)? I am forgetting it at the moment.
1
by: Justin | last post by:
I have a function that has a varchar about 300 characters. When I run the insert command from a function I receive the error SQL0433N - Value .... is too long SQLSTATE=22001. If I run the...
12
by: Ron | last post by:
I am getting an error Option strict on disallows implicit conversion from string to long I get it for this code iStartPosition = InStr(iStartPosition + 1, RichTextBox1.Text, "A" Or "a" the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.