Search results

  1. G

    Option Frame: Get Name and Tag text

    I've been using a Case Select like this: Select Case fraPurchIndexOptions.value Case 1 txtDocType = "PINV" Case 2 txtDocType = "PPAY" Case 3 txtDocType = "SINV" Case 4 txtDocType = "SRCT" End SelectBut I had a similar situation with a tab control...
  2. G

    User Defined Function in SQL Select

    OK I posted a payment of £500 for a supplier where bCredit = true I posted a receipt of £500 for a customer where bCredit = false (the same form) I've checked the table values and tlSalePrice is £500 in each case, two records in the table On sfrmPaymentLineDsheet, txtSalePrice was bound to...
  3. G

    User Defined Function in SQL Select

    OK I put your code in the record source and it works (I think) I get the same records that I expect to show in the bottom datasheet I need to check some stuff out as I've done quite a bit today Should the values show reversed ? Does this mean it's going to tblDocTypes for *every* datasheet...
  4. G

    Option Frame: Get Name and Tag text

    Does anyone know the syntax to get the Option Name, and the Option Button Tag, from the selected option in an Option Group ?
  5. G

    User Defined Function in SQL Select

    You're right the parts are moving as I continue to develop it. The form is my most complex one with two datasheets, each one a view on to a different table and they must be kept in sync to work. Appreciate the help, and you've mentioned posting a db. Do you mean the whole thing ? It has...
  6. G

    User Defined Function in SQL Select

    Yes bCredit is boolean within frmPayment only fDocSign is due for revision. tblDocTypes is being developed but here's the current lookup Public Function fDocSign(strDocType As String) As Boolean Dim db As Database Dim rec As DAO.Recordset Set db = CurrentDb Set rec =...
  7. G

    User Defined Function in SQL Select

    See post #1. txtSalePrice = fSign(bCredit(tlSalePrice)) Where fSign returns the value negated if bCredit is true, it's a public function Where does bCredit come from ? thDocType is the form record, it's a table field for the record that the form is opened with function fDocSign will...
  8. G

    User Defined Function in SQL Select

    OK, sorry yes I'm not explaining myself, Supplier Invoice or Customer Invoice are effectively set by bCredit. It's the same thing really. Likewise Supplier Payment or Customer Receipt are effectively set by bCredit. The iif is perfect sense except I hadn't thought of using it like that. So...
  9. G

    User Defined Function in SQL Select

    bCredit is a main form module boolean set after the two sub forms have loaded. There's a representation of it on the form, the box with the word 'credit' in it, that's just so I know what's going on during development I was originally asking about the payment side, where tlSalePrice (a table...
  10. G

    User Defined Function in SQL Select

    I think a screenshot will be more use than some partly developed code. I thought I had it cracked with the -1 multiply but it's not a complete solution. The form will do what I want it to, it's all about presentation and shielding the user from negative values when they don't expect to see them...
  11. G

    User Defined Function in SQL Select

    bCredit is a boolean evaluated in frmPayment (which is also going to do receipts) So from an index form, user selects a document which could be 'Purchase Payment' or 'Sales Receipt'. Document type is passed in OpenArgs. frmPayment opens. Reads OpenArgs, then goes to a config table and finds...
  12. G

    User Defined Function in SQL Select

    Thanks Colin, I'm not sure that it's the answer. It would be good to know if there's a solution although I'll go with my multiply by -1 method. Because it works well with a dual function invoice form, it edits a sales invoice or a purchase invoice, the user keys positive unsigned values on...
  13. G

    User Defined Function in SQL Select

    I realise I can reference main form stuff from the sub form. Sorry to keep saying it, I must be misunderstanding the working of Access (very likely) but main form or bCredit isn't available when the sub form loads. I realise I can 'late bind' when the main form loads, that's the aim, but...
  14. G

    User Defined Function in SQL Select

    Because it's not available when the sub form loads, it's evaluated in the main form. Sub forms always load first, don't they? Hence the reason I cut the recordsource out of the sub form and into the main form. Is it possible to put a user-defined function *within* a SQL select ? Like post...
  15. G

    User Defined Function in SQL Select

    Not sure how I can explain it better. The bottom line is I want to optionally negate one of the SQL select fields before it's displayed in the datasheet. I don't want to change the value (not yet anyway), I want to display it reversed. Not ABS, not necessarily positive, I want to display it...
  16. G

    User Defined Function in SQL Select

    Yes quite possibly. The user would edit txtSalePrice. Then I would negate it in BeforeUpdate and assign it to tlSalePrice. It's a payment form which I want to serve as a receipts form. But users don't expect to have to key payments as minus values (as in, credit bank account: book...
  17. G

    User Defined Function in SQL Select

    PS I can't use ABS or negate it regardless, the whole point is that I want to see the reversed value according to bCredit. Sometimes the table value might actually be 234.56 and I would want to see that as 234.56-
  18. G

    User Defined Function in SQL Select

    OK thanks DB Guy, I've bound txtSalePrice to tlSalePrice but I get (as I expected) the 'naked' value of tlSalePrice appearing. So I can now see £234.56- but I want it to appear as £234.56 The table value of tlSalePrice is 234.56-, I don't want to change it in this routine, I just want it to...
  19. G

    User Defined Function in SQL Select

    field txtSalePrice is unbound with no data source field tlSalePrice is the table field the sub form has no data source (until it's bound in the main form) When the SQL query runs, the sub form is already loaded. The datasheet fills with data, but the unbound field txtSalePrice is empty. So I...
  20. G

    User Defined Function in SQL Select

    As an enhancement to an existing form I need to bind its recordsource with a SQL select in code, because I need to optionally display one of the columns negated and the criteria for that isn't available when the sub form loads. So, I deleted the recordsource SQL in the data source for the sub...
Back
Top Bottom