Results 1 to 13 of 13
  1. #1
    Synergy.ron@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    73

    Question undefined user type.


    Click image for larger version. 

Name:	user.png 
Views:	34 
Size:	24.5 KB 
ID:	45463Click image for larger version. 

Name:	user2.png 
Views:	35 
Size:	10.8 KB 
ID:	45464Membership.zipI created 2 functions. The second is called by the first. Yet I get an error on compiling mssage.Click image for larger version. 

Name:	user.png 
Views:	34 
Size:	24.5 KB 
ID:	45463 Click image for larger version. 

Name:	user2.png 
Views:	35 
Size:	10.8 KB 
ID:	45464

    What (in english ) does this mean? What did I do to cause this? thanks....
    Last edited by Synergy.ron@gmail.com; 06-10-2021 at 05:49 PM. Reason: attach database file

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    9,446
    A few possibilities but what stands out the most for me is that 'snum i" probably looks like an undefined property or function to Access.
    Perhaps you mean snum & i or more likely, Mid(snum, i, 1)

    Also, you don't have to declare snum in the procedure when you're passing the variable to the function anyway. Odd that you don't declare i though.
    EDIT - another oddity is that you intend to loop, then make the function return only the result of the expression in the very last iteration of the loop. So if it loops 20 times, the function will only return the 20th value, so I don't see the point of that.
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,408
    The "User-defined type not defined" error is because
    Code:
    Public Function getauthcode(snum As Variant) As Text
    Should not be Text - should be STRING


    You have global variables defined (Module level) as well as the procedure level. ??

    I also think the line should be
    Code:
            s4 = s4 & Chr(Mid(snum, i, 1) + 65)
    Notice the comma after snum
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    9,446
    Good catch but the highlight is on the s4 line - or is that just highlight added by the OP? That would be a bad idea to to that for a post.
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

  5. #5
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,408
    @Micron,
    When I tried to compile the code, the compiler highlighted the line
    Code:
    Public Function getauthcode(snum As Variant) As Text
    The s4 line was highlighted because of the syntax error in the MID function. (missing comma)

    As usual, I took so long finding the errors, you replied before I could......

    I'm almost keeping up with you ....
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    9,446
    I agree, compiling (and now that I've tried calling such a function without compiling) it errs on the first line regardless. So if the yellow highlight is added by the OP, that's not a good thing as it will throw people off track. If it's not, then I don't see how it could run at all.
    Methinks it is I who has to catch up to you
    Click image for larger version. 

Name:	1ssanfuCount.jpg 
Views:	38 
Size:	10.7 KB 
ID:	45467
    9329 vs 8942
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

  7. #7
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,408
    But comparing posts/year.:
    YEAR POSTS POSTS/YEAR
    Micron 2014 8946 1278
    ssanfu 2010 9329 848

    I'm not doing that well.....




    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  8. #8
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    9,446
    Quantity never beat quality...
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

  9. #9
    Synergy.ron@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    73
    thanks for the guidance. i've noticed that vb sometimes (without warning) corrects my typing. I suspect that I simply continue to 'see' the old typing despite the change....Anyway it is quite a learning curve getting to know the vb editor; here is the latest brain teaser......The thing of it is "there clearly is an rs.edit. Or does the err mean something not stated? thanks
    Click image for larger version. 

Name:	errupdate.png 
Views:	17 
Size:	27.2 KB 
ID:	45507
    Click image for larger version. 

Name:	rs_err.png 
Views:	19 
Size:	26.3 KB 
ID:	45508
    Attached Thumbnails Attached Thumbnails updateerr.png  

  10. #10
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,408
    You don't show how the record set was declared or how it was opened, nor do you show (the code) how/where you close the record set.

    In the code, You you have
    Code:
    rs.Edit
    rs.MoveFirst
    rs.Fields![serialnumber] = s3
    The MoveFirst commandm is the problem. Apparently, moving to a different record does an automatic save.

    I don't know why you would want to edit the record, then move to the first record, but try this:
    Code:
    .
    .  some commands
    .
       rs.MoveFirst
       rs.Edit
       rs.Fields![serialnumber] = s3
       rs.Update
    
       rs.Close
    .
    .more commands
    .
    .
    Al least I didn't get an error.......
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  11. #11
    Synergy.ron@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    73
    yes, that did it. Can you recommend a good learning source that deals with the idiosyncratic messages that access produces.? Thank you for the assistance.

  12. #12
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,408
    I don't know of any source...... Sometimes the error messages are kinda obtuse and you have to start testing code...
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  13. #13
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    9,446
    Can you recommend a good learning source that deals with the idiosyncratic messages that access produces.?
    Yes. It's called Google and likely goes by other names as well. Since some Access errors have multiple causes, while others have only one, why not use a search engine to return the related posts from all sources related to an error number and message rather than just asking at one particular node in the internet universe?
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

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

Similar Threads

  1. Prompt User To Type Email Addresses
    By Eranka in forum Access
    Replies: 3
    Last Post: 06-02-2018, 11:52 AM
  2. Undefined user-defined data type
    By gar in forum Programming
    Replies: 4
    Last Post: 12-07-2017, 08:26 AM
  3. User-Defined Type Error?
    By excellenthelp in forum Programming
    Replies: 11
    Last Post: 06-25-2014, 07:13 AM
  4. Undefined Function
    By DS928 in forum Access
    Replies: 8
    Last Post: 07-09-2013, 03:53 PM
  5. Error:User-Define type not defined
    By A S MANN in forum Programming
    Replies: 8
    Last Post: 11-05-2011, 04:31 AM

Tags for this Thread

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