Page 6 of 7 FirstFirst 1234567 LastLast
Results 76 to 90 of 98
  1. #76
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107

    this in the SimSerialNumber textbox or the SimStatus in the ASE_Units form?

  2. #77
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    I put it in the SimSerialNumber.
    It gets to a point where it asks if you want to add the new sim.

    get an error from here. "destination fields not the same"
    DEBUG
    CurrentDb.Execute "INSERT INTO Sim_Serials VALUES('" & Me.SimSerialNumber & "')"

    Not sure which name to change

  3. #78
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Is SimStatus field still in Sim_Serials? Either remove it or modify code to:
    CurrentDb.Execute "INSERT INTO Sim_Serials(SimSerialNumber) VALUES('" & Me.SimSerialNumber & "')"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #79
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    Ignore the spreadsheet. That was imported in the tables ages ago. Dont need the sheet anymore. All the data imported from the spreadsheet gets updated within the database.
    Basically what we're trying to do now is divert from using the Simstatus in the SImSerials Table. Using Queries instead.
    The SimStatus in the ASE_Units form and the Sim Serials form seems to be running its outputs from the sim table still.
    So basically i want the Sim status to run from the Queries.

  5. #80
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    Quote Originally Posted by June7 View Post
    Is SimStatus field still in Sim_Serials? Either remove it or modify code to:
    CurrentDb.Execute "INSERT INTO Sim_Serials(SimSerialNumber) VALUES('" & Me.SimSerialNumber & "')"
    I tried removing it and got an error in the ASE form. Couldnt find the reason


    Edit: Ignore above. Thought you meant in the Sim table

  6. #81
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    The insert code works well. Only problem is if you want to modify the SimSerialNumber i.e replace it or remove it. The sims stay as Assigned

    Edit: Actually it does work. Keep looking at the Sim Table and not the query from the reports
    Only wierd thing is if you delete the SimNumber first, it wants to ADD the BLANK field

  7. #82
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try this:

    If Me.SimSerialNumber & "" <> "" Then
    If IsNull(DLookup("SimSerialNumber", "Sim_Serials", "SimSerialNumber='" & Me.SimSerialNumber & "'")) Then
    ...
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #83
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    Quote Originally Posted by June7 View Post
    Try this:

    If Me.SimSerialNumber & "" <> "" Then
    If IsNull(DLookup("SimSerialNumber", "Sim_Serials", "SimSerialNumber='" & Me.SimSerialNumber & "'")) Then
    ...
    That code seems to add the simserialnumber but doesnt bring up the message box anymore. Seems to have solved the remove problem

  9. #84
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    Nope. another problem:
    when i want to add a SimNumber to a ASE that had a previous Sim removed. Got this error:
    The macro or function set to the before update or valiadation rule property for this field is preventing microsoft access from saving the data in the field

    Debug:
    Me.SimSerialNumber = Null

  10. #85
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Use Undo instead. This all works for me.
    Code:
    If Me.SimSerialNumber & "" <> "" Then
        If IsNull(DLookup("SimSerialNumber", "Sim_Serials", "SimSerialNumber='" & Me.SimSerialNumber & "'")) Then
            If MsgBox("This SIM is not in database. Do you want to add?", vbYesNo) = vbYes Then
                CurrentDb.Execute "INSERT INTO Sim_Serials VALUES('" & Me.SimSerialNumber & "')"
            Else
                Cancel = True
                Me.SimSerialNumber.Undo
            End If
        End If
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #86
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    Think thats worked.
    I still want a simstatus to come up showing the status if possible including the cancelled parts.
    I need to refer to the query again somehow dont i?

    And then I think we may be done. untill i have a good check with the system

  12. #87
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    Quote Originally Posted by June7 View Post
    Use Undo instead. This all works for me.
    Code:
    If Me.SimSerialNumber & "" <> "" Then
        If IsNull(DLookup("SimSerialNumber", "Sim_Serials", "SimSerialNumber='" & Me.SimSerialNumber & "'")) Then
            If MsgBox("This SIM is not in database. Do you want to add?", vbYesNo) = vbYes Then
                CurrentDb.Execute "INSERT INTO Sim_Serials VALUES('" & Me.SimSerialNumber & "')"
            Else
                Cancel = True
                Me.SimSerialNumber.Undo
            End If
        End If
    End If
    Nope, Its not copying the Sim into the Sim Serials table anymore.
    tried adding this code to it but didnt work either:
    CurrentDb.Execute "INSERT INTO Sim_Serials(SimSerialNumber) VALUES('" & Me.SimSerialNumber & "')"


    Edit:
    Sortof working. need to open and close the ASE form twice before the message box comes up asking to save the new number. "/

  13. #88
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    I've put it back in the After update and works fine.

    Able to help me with the Status field now?
    I want it to show all 3 status including cancelled.

  14. #89
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    See Post # 69.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #90
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    yeah i tried that. got a "#Error"
    Have I got a field name wrong? I changed the queryname to the name i have mine.

    Ive made a new textbox for it on the ASE_form

Page 6 of 7 FirstFirst 1234567 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 10-13-2011, 08:45 AM
  2. Replies: 4
    Last Post: 05-28-2011, 01:20 AM
  3. Replies: 8
    Last Post: 11-12-2010, 10:55 AM
  4. Changing field data into labels on the y-axis
    By slaterino in forum Access
    Replies: 1
    Last Post: 09-28-2010, 03:15 PM
  5. Replies: 5
    Last Post: 08-20-2010, 06:40 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