Results 1 to 4 of 4
  1. #1
    dsheets05 is offline Novice
    Windows XP Access 2000
    Join Date
    Oct 2010
    Posts
    5

    Switching from string to a number using Dmax

    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


    Private Sub Command14_Click()

    Dim AssyIDvalue As String
    AssyIDvalue = Me.AssemblyID.Value
    Dim MaxComponentID As String
    MaxComponentID = DMax("DrawingID", "Assemblylog", "[AssemblyID]='" & AssyIDvalue & "'") + 1
    Forms!frmAddComponent!DrawingId.Value = MaxComponentID
    DoCmd.GoToRecord , , acNewRec
    stDocName = "frmSubAssemblylog"


    DoCmd.Close acForm, "frmAddComponent"
    Forms!frmstorage!Text0.Value = AssyIDvalue
    DoCmd.OpenForm stDocName ', , , stLinkCriteria
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Here are all three possible syntax's:

    DLookup Usage Samples
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dsheets05 is offline Novice
    Windows XP Access 2000
    Join Date
    Oct 2010
    Posts
    5
    HAHA yea had the damn apostrophes in there :*(.

    THANK YOU!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DMax Condition
    By Luis Ferreira in forum Forms
    Replies: 3
    Last Post: 11-05-2010, 09:48 AM
  2. Remove zeros within a number string
    By catguy in forum Queries
    Replies: 3
    Last Post: 02-25-2010, 07:47 AM
  3. I need to remove a dash from a number string.
    By catguy in forum Programming
    Replies: 3
    Last Post: 02-18-2010, 02:56 PM
  4. Field switching from Number format to Text
    By COforlife in forum Queries
    Replies: 1
    Last Post: 11-10-2009, 03:23 PM
  5. Auto Sequence String Serial Number
    By eddyc99 in forum Programming
    Replies: 2
    Last Post: 10-02-2009, 08:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums