Medication mistakes significantly threaten hospitals, leading to adverse events and increased healthcare costs. Electronic health records (EHRs) have been introduced to reduce the frequency of errors and mitigate these issues. This study aimed to determine if the EHR system reduced medical errors at Lady Reading Hospital (LRH) in Peshawar, Pakistan, thereby enhancing patient safety. A retrospective study was conducted from January 3, 2021, to July 3, 2021. The assessment involved a detailed analysis of medication error incidents at LRH, recorded during this period, involving 200 patients. Data from the Department of Pharmacy were collected and analyzed concerning the occurrence, types, and possible contributing causes of medication errors. The results showed a significant reduction in medication error rates following the implementation of the EHR system. The number of medication errors decreased from 80 incidents to 30 occurrences. Specifically, overall mistakes dropped from 25 to 5, omissions from 15 to 10, and wrong medication reports from 20 to 8. The most common types of errors included dosage errors (accounting for 50 incidents), followed by wrong medication (30 incidents), and omissions (25 incidents). Factors contributing to these errors included communication gaps (20 incidents), transcribing errors (15 incidents), and inadequate training (10 incidents). An evaluation of the severity of these errors revealed 15 minor, 25 moderate, and 10 severe problems. Implementing the EHR system significantly enhanced patient safety by improving communication and providing continuous access to accurate patient information. The findings indicate that EHRs are a crucial component of hospital drug safety, significantly reducing medication errors. Integrating electronic record-keeping facilitates medication management processes, provides real-time information access, and improves communication among healthcare professionals. However, addressing other aspects of system malfunctions and ensuring effective system distribution is essential for successful EHR implementation in healthcare facilities. Future research should focus on designing longitudinal studies to evaluate the long-term safety of medications, the use of EHR systems, and strategies to further improve patient care quality.