Transfer Data To another Record

stu_c

Registered User.
Local time
Today, 21:02
Joined
Sep 20, 2007
Messages
494
Hi all
Hopefully this can be a quick fix
throughout the day we recieve requests to book vehicles sometime smonths in advance.

we have got a table with the vehicle details with a sub forms (main Vehicle Details, Subform Booking details)

we cannot allocate a car until a week previous to the dates required.

we are using a recored (To booked) that we can store all the dates in, the idea really is to have a button we can click that brings up the parameter requesting the REG PLATE for the car that when entered will cut and copy the booking details from the NOT BOOKED into the corrosponding vehicle is this possible?

I dont mind a button beside each record in the sub form but really needs to cut + copy the fields beside it

Field Names are:
FirstName
Surname
Date From
Time From
DateTill
TimeTill
Reason
 
Hi

yesh this could be done with a DAO recordset call. You can connect to another database quite easily too. the process-

make a query based on CARREG. this should be the table holding the information with the 'CRITERIA' set to your forms car reg field. When the query opens, it gets the car reg and only displays information related to that car reg.

connect to database
make DAO call with CARREG as query string
copy data collected into required fields.

VBA
Connect to database

Code:
Dim db as DAO.database
Dim rst As DAO.Recordset
Dim sPath As String

sPath = "C:/MyOtherDatabaseLocation/To booked.mdb"

set db = OpenDatabase(sPath) 
Set rst = db.OpenRecordset("QryNotBooked", dbOpenDynaset)

With rst
Me.fldFirstName = !FirstName
Me.fldSurname = !surname
Me.fldDateFrom = ![Date From]
Me.fldTimeTill = ![Time Till]
Me.fldReason = !Reason

set rst = nothing
Set db = nothing

rst.Close
db.Close

obviously, i have based this on the calling code being from your open form and your field names i have guessed. You will need to correct that yourself.


let me know if that works or if you need any help :)



Nigel
 
I have got a query with a parameter query already called
QRYCarRegSearch which gets the information from TBLCarDetails and also TBLCarBooking

On the form which the NOT BOOKED details is FRMNotBooked and uses a query called QRYNotBooked to show the non allocated results

Looking at the coding think this might be above my knowledge of access :-(

Where / how to I make a DAO call
 
Hi

its not as hard as you think. If you want to send me your db's, i'll do it for you, comment what i have done and send it back.

you can email me

nigel at acccis dot co dot uk


Cheers


nigel
 
I have got the database at work, I'll email it tomorrow if that's okay :-)
 

Users who are viewing this thread

Back
Top Bottom