Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random entries in my database 1

Status
Not open for further replies.

LearnersPermit

Technical User
May 30, 2001
70
CA
Good afternoon. I have a vehicles database made up of several tables and forms. The tables are vehicles, people, results and vehicle_type.

The two main forms are sign out and return forms. This is a one user system but we are having a strange anomaly.

Randomly when the user signs out a vehicle to someone they are signed out for several different vehicles as well as the intended vehicle. The extra vehicles are not necessarily ones that someone else has signed out that day. They are not even always ones that they have previously used.

The user might sign out a dozen vehicles to several different people and among that dozen there will be one that has extra vehicles signed out to them.

Any suggestions

Thanks
 
what process is involved for signing out a vehicle and is there any vba code involved or macro's? if so, what does it look like...can you show us?

how many vehicle's can a person sign out at once?
is the form bound?
are subforms involved?
 
Thank you DanJR for responding.

The user is only able to sign out one vehicle at a time.

There are no subforms involved, however there are two drop-downs which the user can use to select who borrowed a vehicle and the vehicle name. There are also a number of buttons which open other forms to permit her to add leaders and vehicles. She can also check to see which vehicles are already booked.

The form is bound to a query which involves three tables (tblLeaders, tblVehicle and tblResults).

There is VBA associated with this form:

*************************************

Option Compare Database

Private Sub Command9_Click()
DoCmd.OpenForm "frmLeaders", acViewNormal, acEdit
End Sub
Private Sub Add_Vehicles_Click()
On Error GoTo Err_Add_Vehicles_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmVehicle"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Add_Vehicles_Click:
Exit Sub

Err_Add_Vehicles_Click:
MsgBox Err.Description
Resume Exit_Add_Vehicles_Click

End Sub

Private Sub Date_Borrowed_AfterUpdate()

End Sub

Private Sub select_Click()
On Error GoTo Err_select_Click


DoCmd.close acForm, "frmSignout", acSaveYes

Exit_select_Click:
Exit Sub

Err_select_Click:
MsgBox Err.Description
Resume Exit_select_Click

End Sub

Private Sub close_Click()
On Error GoTo Err_close_Click


DoCmd.close acForm, "frmSignout", acSaveNo

Exit_close_Click:
Exit Sub

Err_close_Click:
MsgBox Err.Description
Resume Exit_close_Click

End Sub



Private Sub Vehicles_Out_Click()
On Error GoTo Err_Vehicles_Out_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmVehiclesOut"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Vehicles_Out_Click:
Exit Sub

Err_Vehicles_Out_Click:
MsgBox Err.Description
Resume Exit_Vehicles_Out_Click

End Sub
Private Sub cancel_Click()
On Error GoTo Err_cancel_Click


DoCmd.close acForm, "frmSignout", acSaveNo

Exit_cancel_Click:
Exit Sub

Err_cancel_Click:
MsgBox Err.Description
Resume Exit_cancel_Click

End Sub
 
hi,

can you also show us the sql code for the query the form is bsed on, and what the primary keys are for the underlying tables.

does the sign out form have the ms access nagivation button? Could this be a case of the user entering (temporarily) incorrect data and then nagivating between records - then going to a new record to add the correct sign out event.

are the sign out events (records) time stamped?

i did spot one potential problem:
Code:
Private Sub cancel_Click()
On Error GoTo Err_cancel_Click


    DoCmd.close acForm, "frmSignout", [COLOR=red]acSaveNo[/color]

Exit_cancel_Click:
    Exit Sub

Err_cancel_Click:
    MsgBox Err.Description
    Resume Exit_cancel_Click
    
End Sub

i assume this bit of code is for when the user clicks the "Cancel" button and it is meant to undo any changes in the data?

But the code doesnt work this way....The [tt]acSaveNo[/tt] is whether or not any pending changes in the design of the form should be saved, and has nothing to do with undoing changing for the data in the record.

you should have something like:
Code:
 [COLOR=blue]me.undo[/color]
DoCmd.close acForm, me.name

the data will also be saved (the save is implicit) when the user presses the close button - is this what should happen?

make this small change and see what happens.

you may want to add a bit more logic (checking) to your code to ensure the user knows when a record is saved and when it is not (???)

i'm on holiday for 4 days so...good luck :), any problems then just post back to this thread and others will reply with their expertise.

cheers,
dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top