appending unbound combo query data to new record

M

MarkyMark

This may be covered elsewhere, but my understanding of how to phrase the
question is limited at best.

To set the scene - this is a dB for a weekly running club.

I have a table "RunDetails" (holds details of runners in an event) which has
a lookup field (the date) bound to table "Runs" (details of the event itself).

Form PersData displays the details of runners (name, etc). On this form I
have two unbound texboxes (Bib and Distance) and a date combobox
(cbo.rowsource is query from table 'Runs') and a button to enter their ID,
and the contents of these unbound boxes into table RunDetails.

The only thing that doesn't work is transferring the combobox date into
rundetails as I get a "13- type mismatch" error. I suspect that I am not
referencing the query correctly:

rst.AddNew
rst!RunnerID = IDRef
rst!RunnerBib = Me.EventBibNo
rst!RunnerDistance = Me.EventDistance
rst!RunID = Me.CurrentEventDate!RunID 'This is the bit thats wrong!

Can anyone offer some guidance?
 
T

Tom van Stiphout

On Mon, 8 Mar 2010 05:15:01 -0800, MarkyMark

Speculating I think CurrentEventDate is a dropdown with runs. It
should have a first (likely hidden) column of RunID, BoundColumn set
to 1, and one or more additional visible columns (RunName, RunDate).
If that's correct the line of code should be:
rst!RunID = Me.CurrentEventDate

The bigger question is why you are doing this unbound. Access works
great in bound scenarios, without the need to write code.

-Tom.
Microsoft Access MVP
 
T

TomcatKzn

MarkyMark said:
This may be covered elsewhere, but my understanding of how to phrase the
question is limited at best.

To set the scene - this is a dB for a weekly running club.

I have a table "RunDetails" (holds details of runners in an event) which has
a lookup field (the date) bound to table "Runs" (details of the event itself).

Form PersData displays the details of runners (name, etc). On this form I
have two unbound texboxes (Bib and Distance) and a date combobox
(cbo.rowsource is query from table 'Runs') and a button to enter their ID,
and the contents of these unbound boxes into table RunDetails.

The only thing that doesn't work is transferring the combobox date into
rundetails as I get a "13- type mismatch" error. I suspect that I am not
referencing the query correctly:

rst.AddNew
rst!RunnerID = IDRef
rst!RunnerBib = Me.EventBibNo
rst!RunnerDistance = Me.EventDistance
rst!RunID = Me.CurrentEventDate!RunID 'This is the bit thats wrong!

Can anyone offer some guidance?

Are you sure that you are returning the date value and not some other value.
Check the combo box properties to see what you are returning - the "Bound
column" Box.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top